[Zope-dev] Auto Generated Add Forms

Rowan Woodhouse rwoodhouse at wirelessmeasurement.com
Thu Jan 22 12:07:50 EST 2009


Hi,

I'm trying to use auto-generated add forms in Zope 2.10-6 (Ubuntu) with 
Five but I'm having some trouble getting them to work. I've added the 
section below to my configure.zcml:

<snip configure.zcml>

   <browser:addform
       schema=".democontent.IDemoContent"
       content_factory=".democontent.DemoContent"
       name="addDemoContent.html"
       label="Add Demo View"
       permission="zope2.ViewManagementScreens"
       />

</snip>

But when I try to open the page I get the following error:

2009-01-22T02:01:12 ERROR Zope.SiteErrorLog 
http://192.168.69.132:9673/+/addDemoContent.html
Traceback (innermost last):
   Module ZPublisher.Publish, line 119, in publish
   Module ZPublisher.mapply, line 88, in mapply
   Module ZPublisher.Publish, line 42, in call_object
   Module zope.formlib.form, line 770, in __call__
   Module zope.formlib.form, line 885, in render
   Module zope.formlib.form, line 764, in render
   Module plone.app.form._named, line 26, in __call__
   Module Shared.DC.Scripts.Bindings, line 313, in __call__
   Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
   Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
   Module Products.PageTemplates.PageTemplate, line 89, in pt_render
   Module zope.pagetemplate.pagetemplate, line 117, in pt_render
    - Warning: Macro expansion failed
    - Warning: exceptions.KeyError: 'main_template'
   Module zope.tal.talinterpreter, line 271, in __call__
   Module zope.tal.talinterpreter, line 346, in interpret
   Module zope.tal.talinterpreter, line 870, in do_useMacro
   Module zope.tales.tales, line 696, in evaluate
    - URL: addingpageform
    - Line 1, Column 0
    - Expression: <PathExpr standard:'context/main_template/macros/master'>
    - Names:
       {'container': <+ at />,
        'context': <+ at />,
        'default': <object object at 0xb7e7f538>,
        'here': <+ at />,
        'loop': {},
        'nothing': None,
        'options': {'args': ()},
        'repeat': <Products.PageTemplates.Expressions.SafeMapping object 
at 0xefeebcc>,
        'request': <HTTPRequest, 
URL=http://192.168.69.132:9673/+/addDemo.html>,
        'root': <Application at >,
        'template': <ImplicitAcquirerWrapper object at 0xefeeb4c>,
        'traverse_subpath': [],
        'user': <PropertiedUser 'admin'>,
        'view': <Products.Five.metaclass.DemoContentAddForm object at 
0xedb884c>,
        'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper 
object at 0xefeeb6c>}
   Module zope.tales.expressions, line 217, in __call__
   Module Products.PageTemplates.Expressions, line 153, in _eval
   Module zope.tales.expressions, line 124, in _eval
   Module Products.PageTemplates.Expressions, line 100, in 
trustedBoboAwareZopeTraverse
   Module OFS.Traversable, line 284, in unrestrictedTraverse
    - __traceback_info__: ([], 'main_template')
KeyError: 'main_template'

I've Googled about for an answer but the only reference I can find is this:

http://mail.zope.org/pipermail/zope/2007-November/172544.html

which didn't have a reply (not one that I could find anyway)

Does anyone have any ideas about what I am doing wrong, or how else I 
can get auto-generated add forms working for a Five product?

Thanks,
Rowan



More information about the Zope-Dev mailing list