Is there an easy way to use the interactive shell as though I were the logged in admin user?
Following the documentation for z3c.form on Custom Widgets, I try the following: from z3c.form import testing, form, field testing.setupFormDefaults() from z3c.form.testing import TestRequest request = TestRequest() testing.setUp(request) from z3c.form.browser import text class MyWidget(text.TextWidget): """My new widget.""" klass = u'MyCSS' def MyFieldWidget(field, request): """IFieldWidget factory for MyWidget.""" return widget.FieldWidget(field, MyWidget(request)) class MyEditForm(form.EditForm): fields = field.Fields(IPerson) fields['name'].widgetFactory = MyFieldWidget myEdit = MyEditForm(root[u'srichter'], TestRequest()) I get "root" is not defined. So I figured out something like this... root = request.globs.get('root') If I try again, I get a KeyError (also if I use "admin"). In fact, the root Folder object doesn't have anything in it at all. (If I log in through the ZMI, I have added some objects.) Is there a more correct way to get the root folder? And to run these tests from the prompt, can I do so as though I was logged in (like I do through the ZMI)? Somewhat related, everytime I use the interactive prompt, I copy/paste from bin/test-script.py to set the path to include all my buildout eggs folders. Is there a better way to do this? Thanks again. e. _______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users