[Checkins] SVN: z3c.form/trunk/ - Applied bugfix from Carsten Senger.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 27 00:29:05 EDT 2008


Log message for revision 90376:
  - Applied bugfix from Carsten Senger.
  
  - Fixed a small problem with the new deletion code in managers; also 
    fixed test coverage to 100%.
  
  - Added user-friendlier coverage scripts.
  
  - Updated changes file to reflect Hermann's recent work.
  
  - Updated author list.
  
  Get ready for release.
  
  

Changed:
  U   z3c.form/trunk/AUTHOR.txt
  U   z3c.form/trunk/CHANGES.txt
  U   z3c.form/trunk/buildout.cfg
  U   z3c.form/trunk/setup.py
  U   z3c.form/trunk/src/z3c/form/field.txt
  U   z3c.form/trunk/src/z3c/form/form.py
  U   z3c.form/trunk/src/z3c/form/form.txt
  U   z3c.form/trunk/src/z3c/form/util.py

-=-
Modified: z3c.form/trunk/AUTHOR.txt
===================================================================
--- z3c.form/trunk/AUTHOR.txt	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/AUTHOR.txt	2008-08-27 04:29:04 UTC (rev 90376)
@@ -1,2 +1,8 @@
 Stephan Richter (stephan.richter <at> gmail.com)
 Roger Ineichen (roger <at> projekt01.ch)
+
+Carsten Senger
+Darryl Cousins
+Herman Himmelbauer
+Martijn Faassen
+Paul Carduner

Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/CHANGES.txt	2008-08-27 04:29:04 UTC (rev 90376)
@@ -2,9 +2,20 @@
 CHANGES
 =======
 
-Version 1.9.0 (????-??-??)
+Version 1.9.0 (2008-08-26)
 --------------------------
 
+- Feature: Use the ``query()`` method in the widget manager to try extract a
+  value. This ensures that the lookup is never failing, which is particularly
+  helpful for dictionary-based data managers, where dictionaries might not
+  have all keys.
+
+- Feature: Changed the ``get()`` method of the data manager to throw an error
+  when the data for the field cannot be found. Added ``query()`` method to
+  data manager that returns a default value, if no value can be found.
+
+- Feature: Deletion of widgets from field widget managers is now possible.
+
 - Feature: Groups now produce detailed `ObjectModifiedEvent` descriptions like
   regular edit forms do. (Thanks to Carsten Senger for providing a patch.)
 
@@ -13,6 +24,9 @@
   on the widgets and widget manager during data extraction. Use case: You want
   to inspect the entered data and handle errors manually.
 
+- Bug: The ``ignoreButtons`` flag of the ``z3c.form.form.extends()`` method
+  was not honored. (Thanks to Carsten Senger for providing a patch.)
+
 - Bug: Group classes now implement ``IGroup``. This also helps with the
   detection of group instantiation. (Thanks to Carsten Senger for providing a
   patch.)

Modified: z3c.form/trunk/buildout.cfg
===================================================================
--- z3c.form/trunk/buildout.cfg	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/buildout.cfg	2008-08-27 04:29:04 UTC (rev 90376)
@@ -1,13 +1,20 @@
 [buildout]
 develop = .
-parts = test coverage
+parts = test coverage-test coverage-report
 index = http://download.zope.org/zope3.4
 
 [test]
 recipe = zc.recipe.testrunner
 eggs = z3c.form [test]
 
-[coverage]
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = z3c.form [test]
+defaults = ['--coverage', '../../coverage']
+
+[coverage-report]
 recipe = zc.recipe.egg
 eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')
 

Modified: z3c.form/trunk/setup.py
===================================================================
--- z3c.form/trunk/setup.py	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/setup.py	2008-08-27 04:29:04 UTC (rev 90376)
@@ -44,7 +44,7 @@
 
 setup (
     name='z3c.form',
-    version='1.8.3dev',
+    version='1.9.0',
     author = "Stephan Richter, Roger Ineichen and the Zope Community",
     author_email = "zope-dev at zope.org",
     description = "An advanced form and widget framework for Zope 3",

Modified: z3c.form/trunk/src/z3c/form/field.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/field.txt	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/src/z3c/form/field.txt	2008-08-27 04:29:04 UTC (rev 90376)
@@ -451,8 +451,14 @@
   [('id', <Widget 'form.widgets.id'>),
   ('lastName', <Widget 'form.widgets.lastName'>)]
 
+Note that deleting a non-existent widget causes a ``KeyError`` to be raised:
 
+  >>> del manager['firstName']
+  Traceback (most recent call last):
+  ...
+  KeyError: 'firstName'
 
+
 Properties of widgets within a manager
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Modified: z3c.form/trunk/src/z3c/form/form.py
===================================================================
--- z3c.form/trunk/src/z3c/form/form.py	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/src/z3c/form/form.py	2008-08-27 04:29:04 UTC (rev 90376)
@@ -55,7 +55,7 @@
         f_locals['fields'] = field.Fields()
         for arg in args:
             f_locals['fields'] += getattr(arg, 'fields', field.Fields())
-    if not kwargs.get('ignoreHandlers', False):
+    if not kwargs.get('ignoreButtons', False):
         f_locals['buttons'] = button.Buttons()
         for arg in args:
             f_locals['buttons'] += getattr(arg, 'buttons', button.Buttons())

Modified: z3c.form/trunk/src/z3c/form/form.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/form.txt	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/src/z3c/form/form.txt	2008-08-27 04:29:04 UTC (rev 90376)
@@ -1231,11 +1231,10 @@
       [<Handler for <Button 'apply' u'Apply'>>,
        <Handler for <Button 'cancel' u'Cancel'>>]>
 
-If you, for example do not want to extend the buttons and handlers, you can
-turn that off:
+If you, for example do not want to extend the buttons, you can turn that off:
 
   >>> class DerivedForm(BaseForm):
-  ...     form.extends(BaseForm, ignoreButtons=True, ignoreHandlers=True)
+  ...     form.extends(BaseForm, ignoreButtons=True)
   ...
   ...     fields += field.Fields(IPerson).select('gender')
   ...
@@ -1248,6 +1247,26 @@
   >>> DerivedForm.buttons.keys()
   ['cancel']
   >>> DerivedForm.handlers
+  <Handlers
+      [<Handler for <Button 'apply' u'Apply'>>,
+       <Handler for <Button 'cancel' u'Cancel'>>]>
+
+If you, for example do not want to extend the handlers, you can turn that off:
+
+  >>> class DerivedForm(BaseForm):
+  ...     form.extends(BaseForm, ignoreHandlers=True)
+  ...
+  ...     fields += field.Fields(IPerson).select('gender')
+  ...
+  ...     @button.buttonAndHandler(u'Cancel')
+  ...     def handleCancel(self, action):
+  ...         print 'cancel'
+
+  >>> DerivedForm.fields.keys()
+  ['name', 'gender']
+  >>> DerivedForm.buttons.keys()
+  ['apply', 'cancel']
+  >>> DerivedForm.handlers
   <Handlers [<Handler for <Button 'cancel' u'Cancel'>>]>
 
 

Modified: z3c.form/trunk/src/z3c/form/util.py
===================================================================
--- z3c.form/trunk/src/z3c/form/util.py	2008-08-27 04:28:33 UTC (rev 90375)
+++ z3c.form/trunk/src/z3c/form/util.py	2008-08-27 04:29:04 UTC (rev 90376)
@@ -137,7 +137,7 @@
 
     def __delitem__(self, name):
         if name not in self._data_keys:
-            raise KeyError(_('No such key'))
+            raise KeyError(name)
 
         del self._data_keys[self._data_keys.index(name)]
         value = self._data[name]



More information about the Checkins mailing list