[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - add.py:1.12
Tres Seaver
tseaver@zope.com
Tue, 25 Mar 2003 07:21:12 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv29458/zope/app/browser/form
Modified Files:
add.py
Log Message:
- Refactor AddViewForm's 'createAndAdd' to call an overridable 'create'
(permits making context-aware choices during creation).
- Refactor tests not to call other tests for their side effects /
return values.
=== Zope3/src/zope/app/browser/form/add.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/browser/form/add.py:1.11 Sat Mar 22 14:11:24 2003
+++ Zope3/src/zope/app/browser/form/add.py Tue Mar 25 07:21:09 2003
@@ -68,6 +68,11 @@
return self.update_status
+ def create(self, *args, **kw):
+ """Do the actual instantiation.
+ """
+ return self._factory(*args, **kw)
+
def createAndAdd(self, data):
"""Add the desired object using the data in the data argument.
@@ -83,7 +88,7 @@
if name in data:
kw[str(name)] = data[name]
- content = self._factory(*args, **kw)
+ content = self.create(*args, **kw)
errors = []