--- a/app/soc/views/helper/dynaform.py Wed Jan 28 00:36:30 2009 +0000
+++ b/app/soc/views/helper/dynaform.py Wed Jan 28 00:45:35 2009 +0000
@@ -99,7 +99,7 @@
def extendDynaForm(dynaform, dynainclude=None, dynaexclude=None,
- dynafields=None):
+ dynafields=None, append=False):
"""Extends an existing dynaform.
If any of dynainclude, dynaexclude or dynafields are not present,
@@ -108,6 +108,10 @@
While it is rather useles to extend from a dynaform that does not have
a Meta class, it is allowed, the resulting DynaForm is the same as if
newDynaForm was called with all extendDynForm's keyword arguments.
+
+ If append is True, the form's original values for include and
+ exclude will be appended to the supplied dynainclude and
+ dynaexclude, which both are still allowed to be None.
"""
# Try to retrieve the Meta class from the existing dynaform
@@ -118,10 +122,13 @@
dynamodel = getattr(meta, 'model', None)
if not dynainclude:
- dynainclude = getattr(meta, 'include', None)
+ dynainclude = []
+ if not dynaexclude:
+ dynaexclude = []
- if not dynaexclude:
- dynaexclude = getattr(meta, 'exclude', None)
+ if append:
+ dynainclude += getattr(meta, 'include', [])
+ dynaexclude += getattr(meta, 'exclude', [])
# The most intersting parameter, the 'extra fields' dictionary
dynaconf = getattr(meta, 'dynaconf', {})