I created a custom content type (Resume), and I want to provide a custom "edit" view. My use case is very simple, I just want to show the βopt-outβ HTML window before the edit form.
First of all, I copied:
Products/ATContentTypes/skins/ATContentTypes/atct_edit.cpt Products/ATContentTypes/skins/ATContentTypes/atct_edit.cpt.metadata
in my / product / browser / like
my/product/browser/resumeedit.cpt my/product/browser/resumeedit.cpt.metadata
Then I defined a new browser: stanza pages in my / product / browser / configure.zcml :
<browser:page for="..interfaces.IResume" name="resume_edit" class=".resumeview.ResumeEdit" template="resumeedit.cpt" permission="cmf.ModifyPortalContent" />
The resume class in my / product / browser / resumeview.py looks simple:
class ResumeEdit(BrowserView): """ A customization of the Resume Edit form """ __call__ = ViewPageTemplateFile('resumeedit.cpt')
Finally, I changed the default alias for 'edit' to my / product / profiles / default / types / Resume.xml :
<alias from="edit" to="resume_edit" />
During installation, adding or editing a resume content type causes this exception:
Unauthorized: The container has no security assertions. Access to 'id' of (Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x1e8b7a50) denied.
This is mitigated by providing a revised version of edit_macros.pt :
85c85 < tal:attributes="action python:context.absolute_url()+'/'+template.id; --- > tal:attributes="action python:context.absolute_url()+'/'+path('template/getId|nothing'); 203c203 < tal:attributes="value python:(last_referer and '%s/%s' % (context.absolute_url(), template.id) not in last_referer) and last_referer or (context.getParentNode() and context.getParentNode().absolute_url())" --- > tal:attributes="value python:(last_referer and '%s/%s' % (context.absolute_url(), path('template/getId|nothing')) not in last_referer) and last_referer or (context.getParentNode() and context.getParentNode().absolute_url())"
However, this throws the following exception ('id-64121786' is the identifier of my resume element):
Module zope.tales.tales, line 696, in evaluate - URL: file:/home/zope/env26/plone-devel/eggs/Products.Archetypes-1.6.5-py2.6.egg/Products/Archetypes/skins/archetypes/widgets/field.pt - Line 63, Column 4 - Expression: <PythonExpr errors.get(fieldName)> - Names: {'args': (), 'container': <Resume at /cms/id-64121786>, 'context': <Resume at /cms/id-64121786>, 'default': <object object at 0x8e094c0>, 'here': <Resume at /cms/id-64121786>, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x126e7470>, 'request': <HTTPRequest, URL=http://localhost:8081/cms/id-64121786/resume_edit>, 'root': <Application at >, 'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x117da910>, 'traverse_subpath': [], 'user': <PloneUser 'admin'>, 'view': <Products.Five.metaclass.SimpleViewClass from /home/zope/env26/plone-devel/src/my.product/my/product/browser/resumeedit.cpt object at 0x126d8c90>, 'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x126d8fd0>} Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__ - __traceback_info__: errors.get(fieldName) Module PythonExpr, line 1, in <expression> Module AccessControl.ImplPython, line 688, in guarded_getattr AttributeError: 'NoneType' object has no attribute 'get'
How can I solve this problem and provide my own custom template for editing the look of my content?