[Zope3-checkins] SVN: zope.formlib/trunk/src/zope/formlib/bugs.txt
argh. forgot to checkin bugs.txt,
which contains the test for bug #98438
Christian Zagrodnick
cz at gocept.com
Mon May 5 07:24:36 EDT 2008
Log message for revision 86442:
argh. forgot to checkin bugs.txt, which contains the test for bug #98438
Changed:
A zope.formlib/trunk/src/zope/formlib/bugs.txt
-=-
Added: zope.formlib/trunk/src/zope/formlib/bugs.txt
===================================================================
--- zope.formlib/trunk/src/zope/formlib/bugs.txt (rev 0)
+++ zope.formlib/trunk/src/zope/formlib/bugs.txt 2008-05-05 11:24:35 UTC (rev 86442)
@@ -0,0 +1,65 @@
+Functional tests to verify bugs are gone
+========================================
+
+
+`setupWidgets` and `DISPLAY_UNWRITEABLE`
+++++++++++++++++++++++++++++++++++++++++
+
+This is to verify that bug #219948 is gone: setupWidgets doesn't check for
+write access on the adapter.
+
+Create a form containg two interfaces:
+
+>>> import zope.formlib.tests
+>>> class MyFormBase(object):
+... form_fields = zope.formlib.form.FormFields(
+... zope.formlib.tests.IOrder, zope.formlib.tests.IDescriptive,
+... render_context=zope.formlib.interfaces.DISPLAY_UNWRITEABLE).omit(
+... 'now')
+>>> class MyEditForm(MyFormBase, zope.formlib.form.EditForm):
+... pass
+
+Instanciate the context objects and the form:
+
+>>> import zope.publisher.browser
+>>> request = zope.publisher.browser.TestRequest()
+>>> order = zope.formlib.tests.Order()
+>>> form = MyEditForm(order, request)
+
+When we render the form, the fields of IDescriptive are read only because we
+have no write access (this is configured in ftesting.zcml), the others are
+writable[#needsinteraction]_:
+
+>>> form.setUpWidgets()
+>>> form.widgets['title']
+<zope.app.form.browser.widget.DisplayWidget object at 0x...>
+>>> form.widgets['name']
+<zope.app.form.browser.textwidgets.TextWidget object at 0x...>
+
+
+Make sure we have the same behaviour for non-edit forms:
+
+>>> class MyForm(MyFormBase, zope.formlib.form.Form):
+... pass
+>>> import zope.publisher.browser
+>>> request = zope.publisher.browser.TestRequest()
+>>> order = zope.formlib.tests.Order()
+>>> form = MyForm(order, request)
+>>> form.setUpWidgets()
+>>> form.widgets['title']
+<zope.app.form.browser.widget.DisplayWidget object at 0x...>
+>>> form.widgets['name']
+<zope.app.form.browser.textwidgets.TextWidget object at 0x...>
+
+
+
+Clean up:
+
+>>> zope.security.management.endInteraction()
+
+.. [#needsinteraction]
+
+ >>> import zope.security.management
+ >>> import zope.security.testing
+ >>> request.setPrincipal(zope.security.management.system_user)
+ >>> zope.security.management.newInteraction(request)
Property changes on: zope.formlib/trunk/src/zope/formlib/bugs.txt
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Zope3-Checkins
mailing list