[Zope2.10+] zopectl run conflicts with Traversable
Hi, I (and some co-workers) encountered lately issues with traversal when running scripts using "zopectl run" from the command line. The lookup code fore views apparently expects always the existence of a REQUEST. What's the best approach to fix this issue in the traversal machinery? Andreas ------- File "<string>", line 1, in ? File "import-bb-csv.py", line 92, in ? print r.getRID(),r.getObject() File "/local/HRS2/Devel/stillerj/Zope-2.11.0-b1/lib/python/Products/ZCatalog/CatalogBrains.py", line 92, in getObject target = parent.restrictedTraverse(path[-1]) File "/local/HRS2/Devel/stillerj/Zope-2.11.0-b1/lib/python/OFS/Traversable.py", line 301, in restrictedTraverse return self.unrestrictedTraverse(path, default, restricted=True) File "/local/HRS2/Devel/stillerj/Zope-2.11.0-b1/lib/python/OFS/Traversable.py", line 259, in unrestrictedTraverse next = queryMultiAdapter((obj, self.REQUEST), AttributeError: REQUEST -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting
On Feb 22, 2008, at 17:52 , Andreas Jung wrote:
Hi,
I (and some co-workers) encountered lately issues with traversal when running scripts using "zopectl run" from the command line. The lookup code fore views apparently expects always the existence of a REQUEST. What's the best approach to fix this issue in the traversal machinery?
Is your use case not covered by creating a "fake" request using Testing.makerequest.makerequest, like so: if __name__ == "__main__": from Testing.makerequest import makerequest app = makerequest(app) <do stuff> jens
--On 22. Februar 2008 18:34:14 +0100 Jens Vagelpohl <jens@dataflake.org> wrote:
On Feb 22, 2008, at 17:52 , Andreas Jung wrote:
Hi,
I (and some co-workers) encountered lately issues with traversal when running scripts using "zopectl run" from the command line. The lookup code fore views apparently expects always the existence of a REQUEST. What's the best approach to fix this issue in the traversal machinery?
Is your use case not covered by creating a "fake" request using Testing.makerequest.makerequest, like so:
if __name__ == "__main__": from Testing.makerequest import makerequest app = makerequest(app) <do stuff>
Thanks for the workaround. I think the issue is way of a BBB foul. Traversal did work in the past without having a REQUEST and it should behave in the same way. Andreas
participants (2)
-
Andreas Jung -
Jens Vagelpohl