[Checkins] SVN: z3c.form/trunk/ Make NOT_CHANGED not inherit str.
Dan Korostelev
nadako at gmail.com
Mon Feb 9 21:43:09 EST 2009
Log message for revision 96360:
Make NOT_CHANGED not inherit str.
Check for actual NOT_CHANGED singleton object in the applyChanges instead of equal testing.
Mention the NOT_CHANGED value as a new feature.
XXX: Should'nt NOT_CHANGED be renamed to NOTCHANGED to follow the same naming style as NOVALUE, while it's not late to do so?
Changed:
U z3c.form/trunk/CHANGES.txt
U z3c.form/trunk/src/z3c/form/form.py
U z3c.form/trunk/src/z3c/form/interfaces.py
-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt 2009-02-10 02:25:49 UTC (rev 96359)
+++ z3c.form/trunk/CHANGES.txt 2009-02-10 02:43:09 UTC (rev 96360)
@@ -22,8 +22,14 @@
- setting (sub)widgets early
- setting subwidgets.form
+- Feature: the new ``z3c.form.interfaces.NOT_CHANGED`` special value
+ is available to signal that the current value should be left as is.
+ It's currently handled in the ``z3c.form.form.applyChanges`` function.
+
- Feature: When no file is specified in the file upload widget, instead of
overwriting the value with a missing one, the old data is retained.
+ This is done by returning the new NOT_CHANGED special value from the
+ FileUploadDataConvereter.
- Feature: Added a new flag ``ignoreContext`` to the form field, so that one
can individually select which fields should and which ones should not ignore
Modified: z3c.form/trunk/src/z3c/form/form.py
===================================================================
--- z3c.form/trunk/src/z3c/form/form.py 2009-02-10 02:25:49 UTC (rev 96359)
+++ z3c.form/trunk/src/z3c/form/form.py 2009-02-10 02:43:09 UTC (rev 96360)
@@ -38,7 +38,7 @@
continue
# If the value is NOT_CHANGED, ignore it, since the widget/converter
# sent a strong message not to do so.
- if data[name] == interfaces.NOT_CHANGED:
+ if data[name] is interfaces.NOT_CHANGED:
continue
# Get the datamanager and get the original value
dm = zope.component.getMultiAdapter(
Modified: z3c.form/trunk/src/z3c/form/interfaces.py
===================================================================
--- z3c.form/trunk/src/z3c/form/interfaces.py 2009-02-10 02:25:49 UTC (rev 96359)
+++ z3c.form/trunk/src/z3c/form/interfaces.py 2009-02-10 02:43:09 UTC (rev 96360)
@@ -29,10 +29,12 @@
DISPLAY_MODE = 'display'
HIDDEN_MODE = 'hidden'
-class NOT_CHANGED(str):
+# XXX: should this be changed to NOTCHANGED to follow the
+# same naming style as NOVALUE.
+class NOT_CHANGED(object):
def __repr__(self):
return '<NOT_CHANGED>'
-NOT_CHANGED = NOT_CHANGED()
+NOT_CHANGED = NOT_CHANGED()
class NOVALUE(object):
def __repr__(self):
More information about the Checkins
mailing list