I have a few hundred thousand JSON documents that I want to covert into custom Dexterity objects in Plone. When I create a custom Dexterity content type from scratch, I can use the API to create the object, but it only makes it an uneditable folder object. Not to be undaunted, I created a clone of the Document (Page) object and modified that with new fields. I tweaked my python script (to accommodate the new type-particulars) and tried again. The script ran properly, and the object appeared within Plone. However, when I went to view it, I got the following error:
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 137, in pt_render
Module five.pt.engine, line 98, 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 e7fdcc4a87264bc2f3854392f2992857.py, line 246, in render
Module 029cb43c9143b9c204fbd10c50db7e6f.py, line 1223, in render_master
Module 029cb43c9143b9c204fbd10c50db7e6f.py, line 420, in render_content
Module e7fdcc4a87264bc2f3854392f2992857.py, line 234, in __fill_content_core
Module e7fdcc4a87264bc2f3854392f2992857.py, line 137, in render_content_core
AttributeError: 'str' object has no attribute 'output_relative_to'
- Expression: "python:context.text.output_relative_to(view.context)"
- Filename: ... egg/plone/app/contenttypes/browser/templates/document.pt
- Location: (line 15: col 29)
- Source: ... ucture python:context.text.output_relative_to(view.context)"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Arguments: repeat: {...} (0)
template: <ViewPageTemplateFile - at 0x7ff56bb8e950>
views: <ViewMapper - at 0x7ff56b665850>
modules: <instance - at 0x7ff5761baa70>
args: <tuple - at 0x7ff57e5e7050>
here: <ImplicitAcquisitionWrapper bush-v-gore at 0x7ff56dca0320>
user: <ImplicitAcquisitionWrapper - at 0x7ff56dca0f50>
nothing: <NoneType - at 0x55c21fd724d0>
container: <ImplicitAcquisitionWrapper bush-v-gore at 0x7ff56dca0320>
request: <instance - at 0x7ff56b9d8dd0>
wrapped_repeat: <SafeMapping - at 0x7ff56a1b8208>
traverse_subpath: <list - at 0x7ff56b64ab48>
default: <object - at 0x7ff57e5d0540>
loop: {...} (0)
context: <ImplicitAcquisitionWrapper bush-v-gore at 0x7ff56dca0320>
view: <SimpleViewClass from /opt/plone/buildout-cache/eggs/plone.app.contenttypes-1.4.10-py2.7.egg/plone/app/contenttypes/browser/templates/document.pt document_view at 0x7ff56a0d8c90>
translate: <function translate at 0x7ff56a1a1500>
root: <ImplicitAcquisitionWrapper Zope at 0x7ff56df5f550>
options: {...} (0)
target_language: <NoneType - at 0x55c21fd724d0>
Is there some trick to creating content objects via the API that I'm missing? Some tweak in kwargs that I need to include so the object is viewable and editable?