SVN: zope.formlib/trunk/src/zope/formlib/bugs.txt argh. forgot to checkin bugs.txt, which contains the test for bug #98438

Christian Zagrodnick <[email protected]>
Newsgroups gmane.comp.web.zope.zope3.cvs
Message-ID <20080505112436.177193999D__20963.7403990657$1209986744$gmane$org@mail.zope.org>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.