[Zope-CMF] Examining portal_actions with the Zope app object
from the Python interpreter
Dieter Maurer
dieter@handshake.de
Wed, 28 Aug 2002 22:22:16 +0200
Chris McDonough writes:
> ...
> Instead of doing this, you might be able to "import Zope" (as you
> already know how to do) and get a hold of the "app" object. Then wrap
> the app object in a fake request like so:
>
> from Testing.makerequest import makerequest
> app = makerequest(app)
A similar root:
On
<http://www.dieter.handshake.de/pyprojects/zope>
you find "Interactive debugging support".
It defines "getRequest" and "getAuthRequest" functions
which return a request object.
You can use it to traverse to an object in the same way
ZPublisher does:
R=getAuthRequest(user,password)
obj= R.traverse(url_to_object)
CMF Portal objects do some magic during traversal (it sets up
the SkinTool) which does not happen for attribute access.
Furthermore, you may need authentication to see the correct
actions applicable in the current context.
Dieter