[Grok-dev] subclassing grok.Container

Christian Klinger cklinger at novareto.de
Mon Nov 19 09:34:51 EST 2007


Hi Grok Developers,

i try to make a Container Implementation for strom.zope [1].
I take many ideas from the z3c.zalchemy package in
zope.svn [2].

I think i have some problems by subclassing my StormContainer with
grok.Container.

This is my implementation:

app.py
======
from megrok.storm.stormcontainer import StormContainer

class PersonContainer(StormContainer, grok.Container):
     def __init__(self):
         super(PersonContainer, self).__init__()
         self.setClassName('person.person.person.Person')

class Index(grok.View):
     grok.name('index')
     grok.context(PersonContainer)


class CreatePerson(grok.AddForm):
     grok.context(PersonContainer)
     form_fields = grok.AutoFields(IPerson)

     @grok.action('Create')
     def create(self, **kw):


The Index work on the PersonContainer.

If i try to access <instance of PersonContainer>/createperson
i got the error at the end of this mail.

If i change the order of my BaseClases for
PersonConatiner in: PersonContainer(grok.Container, StromContainer)
i get the createperson AddForm. But i don´t get the StormContainer
Methods.

Any hints?

Christian

[1] https://storm.canonical.com/
[2] http://svn.zope.org/z3c.zalchemy/trunk/src/z3c/zalchemy/


URL: http://192.168.2.23:8080/asd/cont/createperson
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/Paste-1.5-py2.4.egg/paste/evalexception/middleware.py', 
line 306 in respond
   app_iter = self.application(environ, detect_start_response)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.app.wsgi-3.4.0-py2.4.egg/zope/app/wsgi/__init__.py', 
line 54 in __call__
   request = publish(request, handle_errors=handle_errors)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/publish.py', 
line 130 in publish
   obj = request.traverse(obj)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/browser.py', 
line 533 in traverse
   ob = super(BrowserRequest, self).traverse(ob)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/http.py', 
line 453 in traverse
   ob = super(HTTPRequest, self).traverse(obj)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.publisher-3.5.0a1.dev_r78838-py2.4.egg/zope/publisher/base.py', 
line 263 in traverse
   obj = publication.traverseName(self, obj, entry_name)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/grok-0.11-py2.4.egg/grok/publication.py', 
line 37 in traverseName
   result = super(ZopePublicationSansProxy, self).traverseName(
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.app.publication-3.4.2-py2.4.egg/zope/app/publication/publicationtraverse.py', 
line 61 in traverseName
   ob2 = adapter.publishTraverse(request, nm)
File 
'/root/groksandbox/grokstorm/lib/python2.4/site-packages/zope.app.publication-3.4.2-py2.4.egg/zope/app/publication/traversers.py', 
line 44 in publishTraverse
   raise NotFound(ob, name)
NotFound: Object: 'createperson', name: u'index.html'


CGI Variables
-------------
   CHANNEL_CREATION_TIME: 1195489089.8779349
   CONNECTION_TYPE: 'keep-alive'
   GATEWAY_INTERFACE: 'CGI/1.1'
   HTTP_ACCEPT: 
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
   HTTP_ACCEPT_CHARSET: 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
   HTTP_ACCEPT_ENCODING: 'gzip,deflate'
   HTTP_ACCEPT_LANGUAGE: 'en,de;q=0.7,de-de;q=0.3'
   HTTP_AUTHORIZATION: 'Basic YWRtaW46YWRtaW4='
   HTTP_COOKIE: 
'zope3_cs_ba6978a=pXKIOvmBkZM5HawhRHo5NlQxrgc7YH-gOtRppQ7oTuPwGt2usubGKA; 
zope3_cs_ba6d466=u9XS3KfdrfkjA9z6czhKPbgOzY804Yjj8Ep-JXm4a9rt0l8RcPsmJs; 
zope3_cs_ba6d512=ynbvtfLwUs.ZfiyGHLeqY2QBhUsJCTjYpqItFKevEXczmSep-xSyW0; 
zope3_cs_ba6d5e8=CeTu2RUVkBDMwrQ8upkcuFOmeSoWppSe6EOT5tdYewnxdGmlh2mt34; 
zope3_cs_ba6dd9b=QNZVtU1O7azZc6dAiJvfWXzxByMv3QCE3tMjx4T68eDaujxgP9boJ0'
   HTTP_HOST: '192.168.2.23:8080'
   HTTP_KEEP_ALIVE: '300'
   HTTP_REFERER: 'http://192.168.2.23:8080/asd/cont/createperson'
   HTTP_USER_AGENT: 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; de; 
rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9'
   PATH_INFO: '/asd/cont/createperson'
   REMOTE_ADDR: '192.168.2.20'
   REQUEST_METHOD: 'GET'
   SERVER_NAME: 'noname'
   SERVER_PORT: '8080'
   SERVER_PROTOCOL: 'HTTP/1.1'
   SERVER_SOFTWARE: 'zope.server.http'


WSGI Variables
--------------
   application: <zope.app.wsgi.WSGIPublisherApplication object at 
0xb72e6d0c>
   paste.evalexception: <z3c.evalexception.ZopeEvalException object at 
0xb72e6f8c>
   paste.evalexception.debug_count: 1195488346
   paste.expected_exceptions: [<class paste.httpexceptions.HTTPException 
at 0xb742589c>]
   paste.httpexceptions: <paste.httpexceptions.HTTPExceptionHandler 
object at 0xb72ec0ac>
   paste.throw_errors: True
   wsgi process: 'Multithreaded'
   wsgi.handleErrors: False



More information about the Grok-dev mailing list