[zope2-tracker] [Bug 680403] [NEW] unrestrictedTraverse() relies on REQUEST

Mikko Ohtamaa mikko at redinnovation.com
Tue Nov 23 04:14:08 EST 2010


Public bug reported:

unrestrictedTraverse() relies on the presence of acquired HTTP REQUEST
object and does not gracefully handle situation when
unrestrictedTraverse() is called outside HTTP request lifecycle. If you
call getObject() for a catalog brain which does not exist from a command
line script, the following exception is produced.

Sample traceback:

  import ZPublisher, Zope
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "src/collective.mountpoint/collective/mountpoint/bin/update.py", line 31, in ?
    sys.exit(main(app))
  File "/srv/plone/saariselka/src/collective.mountpoint/collective/mountpoint/updateclient.py", line 243, in main
    exit_code = updater.updateAll()
  File "/srv/plone/saariselka/src/collective.mountpoint/collective/mountpoint/updateclient.py", line 151, in updateAll
    mountpoints = list(self.getMountPoints())
  File "/srv/plone/saariselka/src/collective.mountpoint/collective/mountpoint/updateclient.py", line 49, in getMountPoints
    return [ brain.getObject() for brain in brains ]
  File "/srv/plone/saariselka/parts/zope2/lib/python/Products/ZCatalog/CatalogBrains.py", line 86, in getObject
    target = parent.restrictedTraverse(path[-1])
  File "/srv/plone/saariselka/parts/zope2/lib/python/OFS/Traversable.py", line 301, in restrictedTraverse
    return self.unrestrictedTraverse(path, default, restricted=True)
  File "/srv/plone/saariselka/parts/zope2/lib/python/OFS/Traversable.py", line 259, in unrestrictedTraverse
    next = queryMultiAdapter((obj, self.REQUEST),
AttributeError: REQUEST

This is a corner case inside exception handler, but it should still be
able to work without REQUEST.

** Affects: zope2
     Importance: Undecided
         Status: New

-- 
unrestrictedTraverse() relies on REQUEST
https://bugs.launchpad.net/bugs/680403
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list