Guys,
Kindly help me with this query.
I have created a Choice field called "assigned_to" The values are fetched from the vocabulary.
vocabulary:
def assignedTo(context):
assigned=[]
tokens_seen=set()
members=api.user.get_users(groupname='PFSAgent')
for member in members:
if member not in tokens_seen:
assigned.append(SimpleTerm(value=member,token=member,title=member))
tokens_seen.add(member)
return SimpleVocabulary(assigned)
field:
<field name="assigned_to" type="zope.schema.Choice">
<description/>
<required>False</required>
<title>Assigned to</title>
<vocabulary>fincrm.assignedTo</vocabulary>
</field>
function to retrive data:
def loanrequestLink(self):
loanreq=[]
portal_catalog=api.portal.get_tool('portal_catalog')
current_path=self.context.getPhysicalPath()
current_path="/FinCRM/"+current_path[2]+"/"+current_path[3]+"/"+current_path[4]+"/"+current_path[5]
brains=portal_catalog(portal_type="loan_request",path=current_path)
for brain in brains:
loan=brain.getObject()
loanreq.append({
"facility":loan.facility,
"amount":loan.amount_in_crores,
"roi":loan.roi,
"requested_date":loan.requested_date,
"loan_status":loan.loan_status,
"requested_by":loan.requested_by,
"assigned_to":loan.assigned_to,
})
return loanreq
page template:
<div tal:define="loanDet python:view.loanrequestLink()">
<div tal:repeat="loan loanDet">
<div class="col-sm-2">
<h3 id="lab">Assigned To</h3>
<td tal:content="loan/assigned_to">Assigned to</td>
</div>
</div>
</div>
Error:
Here is the full error message:
Display traceback as text
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.Five.browser.metaconfigure, line 485, in __call__
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module five.pt.engine, line 93, in __call__
Module z3c.pt.pagetemplate, line 163, in render
Module chameleon.zpt.template, line 261, in render
Module chameleon.template, line 171, in render
Module a587c174ca6829d38941c16adb4a0cb0.py, line 1361, in render
Module c40646b487ea628523403a16502516ed.py, line 1223, in render_master
Module c40646b487ea628523403a16502516ed.py, line 420, in render_content
Module a587c174ca6829d38941c16adb4a0cb0.py, line 878, in __fill_content_core
Module a587c174ca6829d38941c16adb4a0cb0.py, line 107, in __quote
Module chameleon.zpt.template, line 243, in translate
Module z3c.pt.pagetemplate, line 152, in translate
Module chameleon.i18n, line 66, in fast_translate
Module zope.i18n, line 107, in translate
Module Products.CMFCore.MemberDataTool, line 369, in __str__
Module Products.CMFCore.MemberDataTool, line 273, in getMemberId
Module Products.CMFCore.MemberDataTool, line 264, in getUser
TypeError: exceptions must be old-style classes or derived from BaseException, not str