[Checkins] SVN: z3c.form/branches/fieldsandcontentproviders/ Merging trunk r109921 through r114037

Godefroid Chapelle gotcha at bubblenet.be
Thu Jul 1 04:27:04 EDT 2010


Log message for revision 114038:
  Merging trunk r109921 through r114037

Changed:
  U   z3c.form/branches/fieldsandcontentproviders/AUTHOR.txt
  U   z3c.form/branches/fieldsandcontentproviders/CHANGES.txt
  A   z3c.form/branches/fieldsandcontentproviders/COPYRIGHT.txt
  U   z3c.form/branches/fieldsandcontentproviders/LICENSE.txt
  U   z3c.form/branches/fieldsandcontentproviders/bootstrap.py
  U   z3c.form/branches/fieldsandcontentproviders/setup.py
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio.txt
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio_hidden.pt
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/converter.py
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.py
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.txt
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/field.py
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/form.py
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/locales/z3c.form.pot
  U   z3c.form/branches/fieldsandcontentproviders/src/z3c/form/object.py

-=-
Modified: z3c.form/branches/fieldsandcontentproviders/AUTHOR.txt
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/AUTHOR.txt	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/AUTHOR.txt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -10,13 +10,14 @@
 Dan Korostelev
 Daniel Nouri
 Darryl Cousins
+David Glick
 Herman Himmelbauer
 Jacob Holm
 Laurent Mignon
 Malthe Borch
 Marius Gedminas
 Martijn Faassen
+Martin Aspeli
 Michael Howitz
 Michael Kerrin
 Paul Carduner
-Martin Aspeli
\ No newline at end of file

Modified: z3c.form/branches/fieldsandcontentproviders/CHANGES.txt
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/CHANGES.txt	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/CHANGES.txt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -2,9 +2,25 @@
 CHANGES
 =======
 
-2.3.3 (unreleased)
+2.3.5 (unreleased)
 ------------------
 
+- Bug: Radio widget was not treating value as a list in hidden mode.
+
+
+2.3.4 (2010-05-17)
+------------------
+
+- Bugfix: applyChanges should not try to compare old and new values if the old
+  value can not be accessed.
+
+- Fix DictionaryField to conform to the IDataManager spec: get() should raise
+  an exception if no value can be found.
+
+
+2.3.3 (2010-04-20)
+------------------
+
 - The last discriminator of the 'message' IValue adapter used in the
   ErrorViewSnippet is called 'content', but it was looked up as the error view
   itself. It is now looked up on the form's context.

Copied: z3c.form/branches/fieldsandcontentproviders/COPYRIGHT.txt (from rev 114037, z3c.form/trunk/COPYRIGHT.txt)
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/COPYRIGHT.txt	                        (rev 0)
+++ z3c.form/branches/fieldsandcontentproviders/COPYRIGHT.txt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -0,0 +1 @@
+Zope Foundation and Contributors
\ No newline at end of file

Modified: z3c.form/branches/fieldsandcontentproviders/LICENSE.txt
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/LICENSE.txt	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/LICENSE.txt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -1,54 +1,44 @@
 Zope Public License (ZPL) Version 2.1
--------------------------------------
 
-A copyright notice accompanies this license document that
-identifies the copyright holders.
+A copyright notice accompanies this license document that identifies the
+copyright holders.
 
-This license has been certified as open source. It has also
-been designated as GPL compatible by the Free Software
-Foundation (FSF).
+This license has been certified as open source. It has also been designated as
+GPL compatible by the Free Software Foundation (FSF).
 
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the
-following conditions are met:
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
 
-1. Redistributions in source code must retain the
-   accompanying copyright notice, this list of conditions,
-   and the following disclaimer.
+1. Redistributions in source code must retain the accompanying copyright
+notice, this list of conditions, and the following disclaimer.
 
-2. Redistributions in binary form must reproduce the accompanying
-   copyright notice, this list of conditions, and the
-   following disclaimer in the documentation and/or other
-   materials provided with the distribution.
+2. Redistributions in binary form must reproduce the accompanying copyright
+notice, this list of conditions, and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
 
-3. Names of the copyright holders must not be used to
-   endorse or promote products derived from this software
-   without prior written permission from the copyright
-   holders.
+3. Names of the copyright holders must not be used to endorse or promote
+products derived from this software without prior written permission from the
+copyright holders.
 
-4. The right to distribute this software or to use it for
-   any purpose does not give you the right to use
-   Servicemarks (sm) or Trademarks (tm) of the copyright
-   holders. Use of them is covered by separate agreement
-   with the copyright holders.
+4. The right to distribute this software or to use it for any purpose does not
+give you the right to use Servicemarks (sm) or Trademarks (tm) of the
+copyright
+holders. Use of them is covered by separate agreement with the copyright
+holders.
 
-5. If any files are modified, you must cause the modified
-   files to carry prominent notices stating that you changed
-   the files and the date of any change.
+5. If any files are modified, you must cause the modified files to carry
+prominent notices stating that you changed the files and the date of any
+change.
 
 Disclaimer
 
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS``
-  AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
-  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
-  NO EVENT SHALL THE COPYRIGHT HOLDERS BE
-  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-  DAMAGE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Modified: z3c.form/branches/fieldsandcontentproviders/bootstrap.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/bootstrap.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/bootstrap.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Corporation and Contributors.
+# Copyright (c) 2007 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: z3c.form/branches/fieldsandcontentproviders/setup.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/setup.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/setup.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -45,7 +45,7 @@
 
 setup (
     name='z3c.form',
-    version = '2.3.3dev',
+    version = '2.3.5dev',
     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/branches/fieldsandcontentproviders/src/z3c/form/browser/radio.txt
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio.txt	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio.txt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -115,8 +115,8 @@
   ...     (zope.interface.Interface, IDefaultBrowserLayer, None, None, None),
   ...     IPageTemplate, name='hidden')
 
-  >>> widget.value = 'true'
+  >>> widget.value = ['true']
   >>> widget.mode = interfaces.HIDDEN_MODE
   >>> print widget.render()
-  <input id="widget-id" name="widget.name" value="true" class="hidden-widget" type="hidden" />
+  <input id="widget-id-0" name="widget.name:list" value="true" class="hidden-widget" type="hidden" />
   
\ No newline at end of file

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio_hidden.pt
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio_hidden.pt	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/browser/radio_hidden.pt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -1,13 +1,16 @@
 <div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      tal:omit-tag="">
-<input id="" name="" value="" class="hidden-widget" title=""
-       tabindex="" accesskey=""
-       type="hidden"
-       tal:attributes="id view/id;
-                       name view/name;
-                       title view/title;
-                       tabindex view/tabindex;
-                       accesskey view/accesskey;
-                       value view/value" />
+<tal:block tal:repeat="item view/items">
+  <input id="" name="" value="" class="hidden-widget" title=""
+         tabindex="" accesskey=""
+         type="hidden"
+         tal:condition="item/checked"
+         tal:attributes="id item/id;
+                         name item/name;
+                         title view/title;
+                         tabindex view/tabindex;
+                         accesskey view/accesskey;
+                         value item/value" />
+</tal:block>
 </div>

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/converter.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/converter.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/converter.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -114,7 +114,7 @@
             return self.field.missing_value
         try:
             return self.formatter.parse(value)
-        except zope.i18n.format.NumberParseError, err:
+        except zope.i18n.format.NumberParseError:
             raise FormatterValidationError(self.errorMessage, value)
 
 class IntegerDataConverter(NumberDataConverter):
@@ -265,7 +265,7 @@
         terms = widget.updateTerms()
         try:
             return [terms.getTerm(value).token]
-        except LookupError, err:
+        except LookupError:
             # Swallow lookup errors, in case the options changed.
             return []
 
@@ -274,7 +274,7 @@
         widget = self.widget
         if not len(value) or value[0] == widget.noValueToken:
             return self.field.missing_value
-        terms = widget.updateTerms()
+        widget.updateTerms()
         return widget.terms.getValue(value[0])
 
 
@@ -326,7 +326,6 @@
 
     def toFieldValue(self, value):
         """See interfaces.IDataConverter"""
-        widget = self.widget
         collectionType = self.field._type
         if isinstance(collectionType, tuple):
             collectionType = collectionType[-1]

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -28,6 +28,7 @@
 
 from z3c.form import interfaces
 
+_marker = []
 
 class DataManager(object):
     """Data manager base class."""
@@ -117,7 +118,10 @@
 
     def get(self):
         """See z3c.form.interfaces.IDataManager"""
-        return self.data.get(self.field.__name__, self.field.missing_value)
+        value = self.data.get(self.field.__name__, _marker)
+        if value is _marker:
+            raise AttributeError
+        return value
 
     def query(self, default=interfaces.NO_VALUE):
         """See z3c.form.interfaces.IDataManager"""

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.txt
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.txt	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/datamanager.txt	2010-07-01 08:27:03 UTC (rev 114038)
@@ -283,6 +283,9 @@
 Let's now access the name:
 
   >>> nameDm.get()
+  Traceback (most recent call last):
+  ...
+  AttributeError
 
   >>> nameDm.query()
   <NO_VALUE>

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/field.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/field.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/field.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -161,7 +161,6 @@
         assert len(kwargs) == 0
         if prefix:
             names = [util.expandPrefix(prefix) + name for name in names]
-        fields = [field for field in self.values()]
         return self.__class__(
             *[field for name, field in self.items()
               if not ((name in names and interface is None) or

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/form.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/form.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/form.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -44,9 +44,11 @@
         dm = zope.component.getMultiAdapter(
             (content, field.field), interfaces.IDataManager)
         # Only update the data, if it is different
+        # Or we can not get the original value, in which case we can not check
         # Or it is an Object, in case we'll never know
-        if (dm.get() != data[name]
-            or zope.schema.interfaces.IObject.providedBy(field.field)):
+        if (not dm.canAccess() or 
+            dm.get() != data[name] or 
+            zope.schema.interfaces.IObject.providedBy(field.field)):
             dm.set(data[name])
             # Record the change using information required later
             changes.setdefault(dm.field.interface, []).append(name)

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/locales/z3c.form.pot
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/locales/z3c.form.pot	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/locales/z3c.form.pot	2010-07-01 08:27:03 UTC (rev 114038)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2003-2004 Zope Corporation and Contributors.
+# Copyright (c) 2003-2004 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,

Modified: z3c.form/branches/fieldsandcontentproviders/src/z3c/form/object.py
===================================================================
--- z3c.form/branches/fieldsandcontentproviders/src/z3c/form/object.py	2010-06-30 21:52:31 UTC (rev 114037)
+++ z3c.form/branches/fieldsandcontentproviders/src/z3c/form/object.py	2010-07-01 08:27:03 UTC (rev 114038)
@@ -229,7 +229,7 @@
                 interfaces.IValidator).validate(value)
 
             widget.value = converter.toWidgetValue(value)
-        except (zope.schema.ValidationError, ValueError), error:
+        except (zope.schema.ValidationError, ValueError):
             # on exception, setup the widget error message
             # set the wrong value as value
             # the widget itself ought to cry about the error



More information about the checkins mailing list