I created a Collection object and posted it to the ZODB via the Plone API. The object instantiated, but when I tried to view it, I got the following message:
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 359, in publish_module
Module ZPublisher.WSGIPublisher, line 254, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 63, in call_object
Module zope.browserpage.simpleviewclass, line 41, in __call__
Module Products.Five.browser.pagetemplatefile, line 126, in __call__
Module Products.Five.browser.pagetemplatefile, line 58, in __call__
Module zope.pagetemplate.pagetemplate, line 133, in pt_render
Module Products.PageTemplates.engine, line 367, in __call__
Module z3c.pt.pagetemplate, line 176, in render
Module chameleon.zpt.template, line 307, in render
Module chameleon.template, line 214, in render
Module chameleon.utils, line 75, in raise_with_traceback
Module chameleon.template, line 192, in render
Module f73d060100d62f9f501ab5d4cdb241e6, line 1982, in render
Module 855b424d543568ea95506c22e704ab24, line 860, in render_master
Module 855b424d543568ea95506c22e704ab24, line 1489, in render_content
Module f73d060100d62f9f501ab5d4cdb241e6, line 1967, in __fill_content_core
Module f73d060100d62f9f501ab5d4cdb241e6, line 122, in render_content_core
Module f73d060100d62f9f501ab5d4cdb241e6, line 390, in render_listing
Module zope.tales.expressions, line 250, in __call__
Module Products.PageTemplates.Expressions, line 196, in _eval
Module Products.PageTemplates.Expressions, line 126, in render
Module plone.app.contenttypes.browser.collection, line 47, in batch
Module plone.app.contenttypes.browser.collection, line 42, in results
Module plone.app.contenttypes.behaviors.collection, line 114, in results
Module plone.app.querystring.querybuilder, line 89, in __call__
Module plone.app.querystring.querybuilder, line 120, in _makequery
Module plone.app.querystring.querymodifiers, line 16, in modify_query_to_enforce_navigation_root
Module plone.app.querystring.querymodifiers, line 17, in <genexpr>
TypeError: string indices must be integers
- Expression: "view/batch"
- Filename: ... .egg/plone/app/contenttypes/browser/templates/listing.pt
- Location: (line 22: col 31)
- Source: <tal:results define="batch view/batch;
^^^^^^^^^^
- Expression: "provider:plone.abovecontentbody"
- Filename: ... egg/Products/CMFPlone/browser/templates/main_template.pt
- Location: (line 94: col 70)
- Source: ...
^
- Expression: "context/@@main_template/macros/master"
- Filename: ... .egg/plone/app/contenttypes/browser/templates/listing.pt
- Location: (line 6: col 21)
- Source: ... tal:use-macro="context/@@main_template/macros/master"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Arguments: template: <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x7fadde5f19d0>
options: {}
args: ()
nothing: None
modules: <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter object at 0x7fadf0bc92b0>
request: <WSGIRequest, URL=http://ontology.texasbusinesslaw.org/statutes/united-states/federal/united-states-code-u-s-c/11-u-s-c/11-u-s-c-ss102/listing_view>
view: <Products.Five.browser.metaconfigure.SimpleViewClass from /opt/plone/buildout-cache/eggs/plone.app.contenttypes-2.1.10-py3.8.egg/plone/app/contenttypes/browser/templates/listing.pt object at 0x7fadcdb6b580>
context: <Collection at /data/statutes/united-states/federal/united-states-code-u-s-c/11-u-s-c/11-u-s-c-ss102>
views: <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7fadcdb6bac0>
here: <Collection at /data/statutes/united-states/federal/united-states-code-u-s-c/11-u-s-c/11-u-s-c-ss102>
container: <Collection at /data/statutes/united-states/federal/united-states-code-u-s-c/11-u-s-c/11-u-s-c-ss102>
root: <Application at >
traverse_subpath: []
user: <PloneUser 'ronc'>
default: <DEFAULT>
repeat: <Products.PageTemplates.engine.RepeatDictWrapper object at 0x7fadcd2bf8c0>
loop: {}
target_language: None
translate: <function BaseTemplate.render.<locals>.translate at 0x7fadcfde0a60>
macroname: 'master'
attrs: {}
Note, the code to create the object was:
obj = api.content.create(type='Collection', title=Title, description=Description, subjects=Subjects, query=Query, text=RichTextValue(Text, 'text/plain', 'text/html'), container=container)
Now I had crated several thousand Folder and Document objects with similar code (and all were viewable just fine), but the only difference with the Collections objects were the addition of the query and subjects. In this case, the subjects tuple was a single element, created by:
`Subjects = (Title,)`
... and the Query parameter was created by:
`Query = [Title]`
... which I would have thought would have been okay. Clearly, however, that was not the case. Any idea what the problem might be? My guess is that the query parameter is wrong.