[PEAK] peak.web usage problem or bug

Ulrich Eck ueck at net-labs.de
Thu Dec 4 19:38:33 EST 2003


hi phillip,

i'm currently playing around with peak.web as well.

i tried to create a simple app for testing peak.web capabilities.
i attached the webapp.py file

i also created a debug.py module and the publish-script that uses the
same machinery as cgi but is usable as shell script for debugging
test requests

i wanted to publish a template that is created with web.bindResource.

if have attached the needed files for running the app.

if you do a:
~>./publish index_html

you get back the response of zpublisher correctly

if to do a:
~>./publish test

you get back the error message found in err_templateresource.txt

if you do a:
~>./publish xml

you get back the error message found in err_fileresource.txt

(assuming you have a correct package-setup for the app

wwwmain
  \-resources

i have tried to find these bugs or what i could do wrong 
but i wasn't able to figure it out.

so .. i need help from the expert :)

thanks so far

Ulrich

-- 
-------------------------------

Ulrich Eck
net-labs Systemhaus GmbH
CEO & Code-Artist
Ebersberger Str. 46
85570 Markt Schwaben - Germany

eMail: ueck <at> net-labs.de
phone: +49 8121 4747 10
fax:   +49 8121 4747 77
-------------- next part --------------
A non-text attachment was scrubbed...
Name: webapp.py
Type: text/x-python
Size: 1451 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20031205/99aa4f71/webapp.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug.py
Type: text/x-python
Size: 2362 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20031205/99aa4f71/debug.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: publish
Type: text/x-sh
Size: 305 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20031205/99aa4f71/publish.bin
-------------- next part --------------
[peak.web.resource_packages]
wwwmain.* = True

[peak.running.shortcuts]
publish = importString('wwwmain.debug.PublishTest')

-------------- next part --------------
Status: 200 Ok
Content-Length: 2539
Content-Type: text/plain;charset=iso-8859-1
X-Powered-By: Zope (www.zope.org), Python (www.python.org)

ERROR exceptions.KeyError: PropertyName('xml.testxml') for request: xml
------------------------
  File "/data/src/python/Zope3/src/zope/publisher/publish.py", line 135, in publish
    object = request.traverse(object)

  File "/data/src/python/Zope3/src/zope/publisher/browser.py", line 606, in traverse
    ob = super(BrowserRequest, self).traverse(object)

  File "/data/src/python/Zope3/src/zope/publisher/http.py", line 431, in traverse
    ob = super(HTTPRequest, self).traverse(object)

  File "/data/src/python/Zope3/src/zope/publisher/base.py", line 244, in traverse
    publication.callTraversalHooks(self, object)

  File "/usr/lib/python2.3/site-packages/peak/web/publish.py", line 200, in callTraversalHooks
    ob.checkPreconditions()

  File "/usr/lib/python2.3/site-packages/peak/web/places.py", line 63, in checkPreconditions
    self.traversable.preTraverse(self)

  File "/usr/lib/python2.3/site-packages/peak/web/resources.py", line 276, in preTraverse
    self.getObject(ctx.interaction).preTraverse(ctx)

  File "/usr/lib/python2.3/site-packages/peak/web/resources.py", line 51, in preTraverse
    perm = self.permissionNeeded

  File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112, in _once.BaseDescriptor.__get__

  File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100, in _once.__get__

  File "/usr/lib/python2.3/site-packages/peak/binding/components.py", line 442, in computeValue
    return self.targetName.findComponent(obj, self.default)

  File "/usr/lib/python2.3/site-packages/peak/binding/components.py", line 395, in findComponent
    return config.findUtility(component, self.ob, default)

  File "/usr/lib/python2.3/site-packages/peak/config/config_components.py", line 87, in findUtility
    for u in findUtilities(component, iface):

  File "/usr/lib/python2.3/site-packages/peak/config/config_components.py", line 69, in findUtilities
    utility = utility(forObj, iface)

  File "/usr/lib/python2.3/site-packages/peak/binding/components.py", line 826, in _getConfigData
    value = attr.getValueFor(forObj, configKey)

  File "/usr/lib/python2.3/site-packages/peak/config/config_components.py", line 307, in getValueFor
    value = rule.get()(self, configKey, forObj)

  File "/usr/lib/python2.3/site-packages/peak/config/config_components.py", line 109, in f
    result = eval(expr)

  File "<string>", line 0, in ?

  File "/usr/lib/python2.3/site-packages/peak/config/config_components.py", line 628, in __getitem__
    raise KeyError,key
------------------------

-------------- next part --------------
Status: 200 Ok
Content-Length: 1087
Content-Type: text/plain;charset=iso-8859-1
X-Powered-By: Zope (www.zope.org), Python (www.python.org)

ERROR exceptions.AttributeError: 'TemplateDocument' object has no attribute 'preTraverse' for request: test
------------------------
  File "/data/src/python/Zope3/src/zope/publisher/publish.py", line 135, in publish
    object = request.traverse(object)

  File "/data/src/python/Zope3/src/zope/publisher/browser.py", line 606, in traverse
    ob = super(BrowserRequest, self).traverse(object)

  File "/data/src/python/Zope3/src/zope/publisher/http.py", line 431, in traverse
    ob = super(HTTPRequest, self).traverse(object)

  File "/data/src/python/Zope3/src/zope/publisher/base.py", line 244, in traverse
    publication.callTraversalHooks(self, object)

  File "/usr/lib/python2.3/site-packages/peak/web/publish.py", line 200, in callTraversalHooks
    ob.checkPreconditions()

  File "/usr/lib/python2.3/site-packages/peak/web/places.py", line 63, in checkPreconditions
    self.traversable.preTraverse(self)

  File "/usr/lib/python2.3/site-packages/peak/web/resources.py", line 276, in preTraverse
    self.getObject(ctx.interaction).preTraverse(ctx)
------------------------



More information about the PEAK mailing list