[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_add.py:1.14
Jim Fulton
jim@zope.com
Thu, 5 Jun 2003 16:13:38 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form/tests
In directory cvs.zope.org:/tmp/cvs-serv24717/src/zope/app/browser/form/tests
Modified Files:
test_add.py
Log Message:
Changed the way widgets are created and stored in forms.
Widgets (views on fields) were stored in attributes with the same
names as the fields. This led to conflicts with other view attribute
names in some cases. Now widgets are stored in attributes with names
equal to the field name with an added suffix of '_widget'. For
example, the widget for a title field is named "title_widget".
=== Zope3/src/zope/app/browser/form/tests/test_add.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/form/tests/test_add.py:1.13 Wed Apr 30 19:37:52 2003
+++ Zope3/src/zope/app/browser/form/tests/test_add.py Thu Jun 5 16:13:07 2003
@@ -48,7 +48,7 @@
class I(Interface):
- name_ = TextLine()
+ name = TextLine()
first = TextLine()
last = TextLine()
email = TextLine()
@@ -69,22 +69,22 @@
def setfoo(self, v): self._foo = v
class V:
- name_ = CustomWidget(Text)
- first = CustomWidget(Text)
- last = CustomWidget(Text)
- email = CustomWidget(Text)
- address = CustomWidget(Text)
- getfoo = CustomWidget(Text)
- extra1 = CustomWidget(Text)
- extra2 = CustomWidget(Text)
+ name_widget = CustomWidget(Text)
+ first_widget = CustomWidget(Text)
+ last_widget = CustomWidget(Text)
+ email_widget = CustomWidget(Text)
+ address_widget = CustomWidget(Text)
+ getfoo_widget = CustomWidget(Text)
+ extra1_widget = CustomWidget(Text)
+ extra2_widget = CustomWidget(Text)
class FooV:
- bar = CustomWidget(Text)
+ bar_widget = CustomWidget(Text)
class SampleData:
- name_ = u"foo"
+ name = u"foo"
first = u"bar"
last = u"baz"
email = u"baz@dot.com"
@@ -123,7 +123,7 @@
result1 = self._invoke_add()
result2 = self._invoke_add(
- fields="name_ first last email address getfoo extra1 extra2",
+ fields="name first last email address getfoo extra1 extra2",
)
self.assertEqual(result1, result2)
@@ -152,7 +152,7 @@
self.assertEqual(bases, (V, AddView, ))
self.assertEqual(for_, IAdding)
self.assertEqual(" ".join(fields),
- "name_ first last email address getfoo extra1 extra2")
+ "name first last email address getfoo extra1 extra2")
self.assertEqual(content_factory, C)
self.assertEqual(" ".join(arguments),
"first last")
@@ -161,7 +161,7 @@
self.assertEqual(" ".join(set_before_add),
"getfoo")
self.assertEqual(" ".join(set_after_add),
- "extra1 name_ address extra2")
+ "extra1 name address extra2")
self.failIf(kw)
return args
@@ -229,7 +229,7 @@
self.assertEqual(adding.ob.extra1, "extra1")
self.assertEqual(adding.ob.extra2, "extra2")
- self.assertEqual(adding.ob.name_, "foo")
+ self.assertEqual(adding.ob.name, "foo")
self.assertEqual(adding.ob.address, "aa")
def test_createAndAdd_w_adapter(self):
@@ -303,7 +303,7 @@
self.assertEqual(l[0].extra1, "extra1")
self.assertEqual(l[0].extra2, "extra2")
- self.assertEqual(l[0].name_, "foo")
+ self.assertEqual(l[0].name, "foo")
self.assertEqual(l[0].address, "aa")
self.assertEqual(request.response.getHeader("Location"), "next")