Some things you may want to call in the debugger may require a real REQUEST object, as if they were being published on the web. This zopelabs recipe shows how to make one:
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManager import setSecurityPolicy from Testing.makerequest import makerequest from Products.CMFCore.tests.base.security import PermissiveSecurityPolicy, OmnipotentUser _policy=PermissiveSecurityPolicy() _oldpolicy=setSecurityPolicy(_policy) newSecurityManager(None, OmnipotentUser().__of__(app.acl_users)) app=makerequest(app)
Tip: it's useful to do this at the beginning of every debug session. I add it to a file named ~/.zopedebugrc and then my first command is always:
>>> execfile('/home/myusername/.zopedebugrc')
Another way
You can also go through ZPublisher, which provides a real REQUEST, by using::
>>> Zope2.debug(/site/object)
See ... for additional arguments you can use (u="name:pass", d=1, pm=1 etc.) With Zope 2.7 and earlier it's Zope.debug, not Zope2.
See also How to become manager in debugger.