I am trying to create a list of talks that I have created . I am getting the following error.
We’re sorry, but there seems to be an 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 191, in render
Module chameleon.template, line 171, in render
Module 3ef2a5db72e95e7bd0b6d689ac8a4c8b.py, line 152, in render
Module ploneconf.site.browser.views, line 28, in talks
TypeError: 'str' object is not callable
- Expression: "python:view.talks()"
- Filename: ... ite/src/ploneconf/site/browser/templates/talkviewlist.pt
- Location: (line 15: col 29)
- Source: ... tbody tal:define="talks python:view.talks()">
^^^^^^^^^^^^^^^^^^^- Arguments: repeat: {...} (0)
template: <ViewPageTemplateFile - at 0x7f55085f8cd0>
views: <ViewMapper - at 0x7f5507e77fd0>
modules: <instance - at 0x7f551312a0e0>
args: <tuple - at 0x7f551ba29050>
here: <ImplicitAcquisitionWrapper Plone5 at 0x7f550873f410>
user: <ImplicitAcquisitionWrapper - at 0x7f550a9608c0>
nothing: <NoneType - at 0x5585e247d560>
container: <ImplicitAcquisitionWrapper Plone5 at 0x7f550873f410>
request: <instance - at 0x7f55084a0710>
wrapped_repeat: <SafeMapping - at 0x7f5509b3fe10>
traverse_subpath: <list - at 0x7f5507fb35a8>
default: <object - at 0x7f551b948550>
loop: {...} (0)
context: <ImplicitAcquisitionWrapper Plone5 at 0x7f550873f410>
view: <SimpleViewClass from /home/ananth/Plone/zinstance/src/ploneconf.site/src/ploneconf/site/browser/templates/talkviewlist.pt talklistview at 0x7f5507e77350>
translate: <function translate at 0x7f5507fa12a8>
root: <ImplicitAcquisitionWrapper Zope at 0x7f550a9f22d0>
options: {...} (0)
target_language: <NoneType - at 0x5585e247d560>
The browser/configure.xml:
<browser:page
name="talklistview"
for="*"
layer="zope.interface.Interface"
class=".views.TalkListView"
template="templates/talkviewlist.pt"
permission="zope2.View"
/>
views.py
class TalkListView(BrowserView):
def talks(self):
results=
portal_catalog=api.portal.get_tool('portal_catalog')
current_path="/".join(self.context.getPhysicalPath())brains=portal_catalog(portal_type="talk",path=current_path()) for brain in brains: talk=brain.getObject() results.append({ 'title':brain.title, 'description':brain.Description, 'url':brain.getURL(), 'audience':','.join(talk.audience), 'type_of_talk':talk.type_of_talk, 'speaker':talk.speaker, 'uuid':brain.UID }) return results
templates/talkviewlist.pt
<tbody tal:define="talks python:view.talks()">