[Grok-dev] Re: ViewletManager in grok.AddForm

Christian Klinger cklinger at novareto.de
Wed Jan 16 09:43:40 EST 2008


Hi again,

i have found a solution for the problem, but i have absolutly
no idea why this now works...

Maybe someone of you knows...



class CreateArzt(grok.AddForm, grok.View):
                                *********
     grok.context(ArztContainer)
     template = grok.PageTemplateFile('form.pt')
     form_fields = grok.AutoFields(IArzt)
     grok.require('artus.ManageArzt')

I have to subclass from grok.View too, than the error goes away.

Christian


> Hi,
> 
> i try to work with pure Z3 viewlets in my grok Application.
> 
> I have configured my viewletmanager and my viewlets with
> this piece of zcml:
> 
>         <browser:viewletManager
>                 name="demo1vmprovider"
>                 permission="zope.Public"
>                 provides=".viewletmanager.INaviManager"
>                 class=".viewletmanager.NaviManager"
>                 template="viewletmanager.pt"
>                 />
> 
>         <browser:viewlet
>                 name="demo1viewlet"
>                 for="*"
>                 manager=".viewletmanager.INaviManager"
>                 class=".viewletmanager.Viewlet"
>                 permission="zope.Public"
>                 />
> 
> I have included the viewletManager in my master.pt with this statement:
> 
>    <p tal:content="structure provider:demo1vmprovider" />
> 
> This works just fine.
> 
> But i get problems if i try to access an grok.AddForm or an 
> grok.EditForm. If i try to access one of these i got this error:
> 
> 2008-01-15T17:32:40 ERROR SiteError 
> http://192.168.2.23:8080/artus/ac/createarzt
> Traceback (most recent call last):
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py", 
> line 133, in publish
>     result = publication.callObject(request, obj)
>   File 
> "/root/seebg/lib/python2.4/site-packages/grok-0.11-py2.4.egg/grok/publication.py", 
> line 45, in callObject
>     return super(ZopePublicationSansProxy, self).callObject(request, ob)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.app.publication-3.4.2-py2.4.egg/zope/app/publication/zopepublication.py", 
> line 167, in callObject
>     return mapply(ob, request.getPositionalArguments(), request)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py", 
> line 108, in mapply
>     return debug_call(obj, args)
>    - __traceback_info__: <artus.app.CreateArzt object at 0xb4334fec>
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py", 
> line 114, in debug_call
>     return obj(*args)
>   File 
> "/root/seebg/lib/python2.4/site-packages/grok-0.11-py2.4.egg/grok/components.py", 
> line 498, in __call__
>     return self.render()
>   File 
> "/root/seebg/lib/python2.4/site-packages/grok-0.11-py2.4.egg/grok/components.py", 
> line 481, in render
>     self.form_result = self._render_template()
>   File 
> "/root/seebg/lib/python2.4/site-packages/grok-0.11-py2.4.egg/grok/components.py", 
> line 141, in _render_template
>     return self.template.render(self)
>   File 
> "/root/seebg/lib/python2.4/site-packages/grok-0.11-py2.4.egg/grok/components.py", 
> line 334, in render
>     return template.pt_render(namespace)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.pagetemplate-3.4.0a1-py2.4.egg/zope/pagetemplate/pagetemplate.py", 
> line 115, in pt_render
>     strictinsert=0, sourceAnnotations=sourceAnnotations)()
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 271, in __call__
>     self.interpret(self.program)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 346, in interpret
>     handlers[opcode](self, args)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 891, in do_useMacro
>     self.interpret(macro)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 346, in interpret
>     handlers[opcode](self, args)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 957, in do_defineSlot
>     self.interpret(block)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 346, in interpret
>     handlers[opcode](self, args)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tal-3.4.0b1-py2.4.egg/zope/tal/talinterpreter.py", 
> line 745, in do_insertStructure_tal
>     structure = self.engine.evaluateStructure(expr)
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.tales-3.4.0a1-py2.4.egg/zope/tales/tales.py", 
> line 696, in evaluate
>     return expression(self)
>    - /root/seebg/artus/artus/app_templates/master.pt
>    - Line 49, Column 3
>    - Expression: <StringExpr u'demo1vmprovider'>
>    - Names:
>       {'args': (),
>        'context': <artus.app.ArztContainer object at 0xb439786c>,
>        'default': <object object at 0xb7cfd508>,
>        'loop': {},
>        'nothing': None,
>        'options': {},
>        'repeat': {},
>        'request': <zope.publisher.browser.BrowserRequest instance 
> URL=http://192.168.2.23:8080/artus/ac/createarzt>,
>        'static': <grok.components.DirectoryResource object at 0xb4334c2c>,
>        'template': <grok.components.TrustedFilePageTemplate object at 
> 0xb67c9aac>,
>        'view': <artus.app.CreateArzt object at 0xb4334fec>}
>   File 
> "/root/seebg/lib/python2.4/site-packages/zope.contentprovider-3.4.0-py2.4.egg/zope/contentprovider/tales.py", 
> line 66, in __call__
>     raise interfaces.ContentProviderLookupError(name)
> ContentProviderLookupError: demo1vmprovider
> 
> 
> Maybe someone as an idea what to do...
> 
> Thanks in advance
> 
> Christian



More information about the Grok-dev mailing list