I've created an importer for a custom dexterity content type. It imports the types fine, but I get 'LocationError' when I try to view the newly imported content I get the following traceback:
Traceback (innermost last):
Module ZPublisher.Publish, line 60, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module grokcore.view.components, line 140, in __call__
Module grokcore.view.components, line 144, in _render_template
Module five.grok.components, line 130, in render
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in __call__
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 946, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: /home/action/workspace/zeocluster/src/collective.nonprofitprogrammes/collective/nonprofitprogrammes/programme_templates/programmeview.pt
- Line 20, Column 8
- Expression: <PathExpr standard:u'context/background/output'>
- Names:
{'args': (),
'container': <Programme at /Plone2/my-content/dry-forest-conservation-programme>,
'context': <Programme at /Plone2/my-content/dry-forest-conservation-programme>,
'default': <object object at 0x7f60dda304e0>,
'here': <Programme at /Plone2/my-content/dry-forest-conservation-programme>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7f60cc0673c0>,
'request': <HTTPRequest, URL=http://mybox-23772.use1.actionbox.io:8080/Plone2/my-content/dry-forest-conservation-programme/programmeview>,
'root': <Application at >,
'static': <Products.Five.metaclass.DirectoryResource12 object at 0x7f60cc073ed0>,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x8ee7550>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <collective.nonprofitprogrammes.programme.ProgrammeView object at 0x7f60cc073bd0>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7f60cc073c10>}
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 147, in _eval
Module zope.tales.expressions, line 124, in _eval
Module Products.PageTemplates.Expressions, line 97, in trustedBoboAwareZopeTraverse
Module zope.traversing.adapters, line 136, in traversePathElement
- __traceback_info__: (u'Jam...ation.\n', 'output', [])
LocationError: (u'Jam...ation.\n', 'output')
Interestingly visiting the url of the content type followed by /edit works and after saving the changes the view works.
The "output" portion of the LocationError message suggests that it is having trouble rendering a RichText field. Is it possible that you initialized a RichText field with something other than a RichTextValue?
You cannot just assign a string to a RichText field. It requires a RichTextValue:
from plone.app.textfield.value import RichTextValue
context.body = RichTextValue(u"Your text here, in HTML")
See the Dexterity Developer's Manual section on RichTextValue for details. It allows you to set the input and output mime types as well as the text.