[PEAK] peak.web bugs

Radek Kanovsky rk at dat.cz
Thu Dec 4 11:30:16 EST 2003


Hi,

I have found two small bugs in peak.web:

    peak/web/errors.py:
    @@ -48,6 +48,7 @@
             parent = ctx.getParentComponent()
             name   = ctx.getComponentName()
             newCtx = parent.subcontext(name, self)
    +        return newCtx
     
     

    peak/web/resources.py:
    @@ -6,7 +6,7 @@
     from peak.naming.factories.openable import FileURL
     from peak.util.imports import importString
     import os.path, posixpath, sys
    -from errors import UnsupportedMethod
    +from errors import UnsupportedMethod, NotFound
     
     __all__ = [
         'Resource', 'FSResource', 'ResourceDirectory', 'FileResource',





Another problem is exception handling. When some Traversable.traverseTo
raises IWebException (NotFound, NotAllowed, ...), I get 500 - internal
server error and not 4XX response from server:

    Status: 500 The engines can't take any more, Jim!
    Content-Length: 0
    X-Powered-By: Zope (www.zope.org), Python (www.python.org)

    Traceback (most recent call last):
      File "/www/wm4/wm4.cgi", line 106, in ?
        publisher.runCGI(sys.stdin, sys.stdout, sys.stderr, os.environ)
      File "./publish.py", line 432, in runCGI
      File "./zope/publisher/publish.py", line 146, in publish
      File "./publish.py", line 266, in handleException
      File "./errors.py", line 71, in handleException
      File "./errors.py", line 50, in renderingContext
    AttributeError: 'Skin' object has no attribute 'subcontext'

Or:

    Status: 500 The engines can't take any more, Jim!
    Content-Length: 0
    X-Powered-By: Zope (www.zope.org), Python (www.python.org)

    Traceback (most recent call last):
      File "/www/wm4/wm4.cgi", line 106, in ?
        publisher.runCGI(sys.stdin, sys.stdout, sys.stderr, os.environ)
      File "./publish.py", line 432, in runCGI
      File "./zope/publisher/publish.py", line 146, in publish
      File "./publish.py", line 266, in handleException
      File "./errors.py", line 72, in handleException
      File "./places.py", line 95, in contextFor
      File "./places.py", line 245, in traverseTo
      File "./places.py", line 180, in traverseTo
      File "./binding/once.py", line 420, in __get__
      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 "./binding/once.py", line 498, in <lambda>
      File "./errors.py", line 33, in template
      File "./skins.py", line 95, in getResource
      File "./publish.py", line 64, in traverse
      File "./places.py", line 95, in contextFor
      File "./places.py", line 318, in traverseTo
    peak.web.errors.NotFound

It seems to me that exception handling system relies on some templates
that are not available. I don't understand Resources and Skins yet so I
am guessing.

Regards

RadekK



More information about the PEAK mailing list