[Checkins] SVN: z3c.form/trunk/src/z3c/form/ Rename choice_terms_multiplexer and collection_terms_multiplexer back to ChoiceTerms and CollectionTerms to try to maintain backward compatibility. However they was changed from classes to functions and that needs to be stated as important in the changelog.

Dan Korostelev nadako at gmail.com
Mon Feb 9 22:34:00 EST 2009


Log message for revision 96363:
  Rename choice_terms_multiplexer and collection_terms_multiplexer back to ChoiceTerms and CollectionTerms to try to maintain backward compatibility. However they was changed from classes to functions and that needs to be stated as important in the changelog.
  
  Thus, unbreak the benchmarking suite.

Changed:
  U   z3c.form/trunk/src/z3c/form/configure.zcml
  U   z3c.form/trunk/src/z3c/form/converter.txt
  U   z3c.form/trunk/src/z3c/form/term.py
  U   z3c.form/trunk/src/z3c/form/term.txt
  U   z3c.form/trunk/src/z3c/form/testing.py
  U   z3c.form/trunk/src/z3c/form/widget.txt

-=-
Modified: z3c.form/trunk/src/z3c/form/configure.zcml
===================================================================
--- z3c.form/trunk/src/z3c/form/configure.zcml	2009-02-10 03:11:12 UTC (rev 96362)
+++ z3c.form/trunk/src/z3c/form/configure.zcml	2009-02-10 03:34:00 UTC (rev 96363)
@@ -77,7 +77,7 @@
 
   <!-- ITerms -->
   <adapter
-      factory=".term.choice_terms_multiplexer"
+      factory=".term.ChoiceTerms"
       />
   <adapter
       factory=".term.ChoiceTermsVocabulary"
@@ -86,7 +86,7 @@
       factory=".term.ChoiceTermsSource"
       />
   <adapter
-      factory=".term.collection_terms_multiplexer"
+      factory=".term.CollectionTerms"
       />
   <adapter
       factory=".term.CollectionTermsVocabulary"

Modified: z3c.form/trunk/src/z3c/form/converter.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/converter.txt	2009-02-10 03:11:12 UTC (rev 96362)
+++ z3c.form/trunk/src/z3c/form/converter.txt	2009-02-10 03:34:00 UTC (rev 96363)
@@ -487,7 +487,7 @@
   >>> import zc.sourcefactory.browser.token
   >>> zope.component.provideAdapter(term.ChoiceTermsVocabulary)
   >>> zope.component.provideAdapter(term.ChoiceTermsSource)
-  >>> zope.component.provideAdapter(term.choice_terms_multiplexer)
+  >>> zope.component.provideAdapter(term.ChoiceTerms)
   >>> zope.component.provideAdapter(
   ...     zc.sourcefactory.browser.source.FactoredTerms)
   >>> zope.component.provideAdapter(
@@ -619,7 +619,7 @@
 field. Before we can use the converter, we have to register the terms adapters:
 
   >>> from z3c.form import term
-  >>> zope.component.provideAdapter(term.collection_terms_multiplexer)
+  >>> zope.component.provideAdapter(term.CollectionTerms)
   >>> zope.component.provideAdapter(term.CollectionTermsVocabulary)
   >>> zope.component.provideAdapter(term.CollectionTermsSource)
 

Modified: z3c.form/trunk/src/z3c/form/term.py
===================================================================
--- z3c.form/trunk/src/z3c/form/term.py	2009-02-10 03:11:12 UTC (rev 96362)
+++ z3c.form/trunk/src/z3c/form/term.py	2009-02-10 03:34:00 UTC (rev 96363)
@@ -92,7 +92,7 @@
     zope.interface.Interface,
     zope.schema.interfaces.IChoice,
     interfaces.IWidget)
-def choice_terms_multiplexer(context, request, form, field, widget):
+def ChoiceTerms(context, request, form, field, widget):
     field = field.bind(context)
     terms = field.vocabulary
     return zope.component.queryMultiAdapter(
@@ -170,7 +170,7 @@
     zope.interface.Interface,
     zope.schema.interfaces.ICollection,
     interfaces.IWidget)
-def collection_terms_multiplexer(context, request, form, field, widget):
+def CollectionTerms(context, request, form, field, widget):
     terms = field.value_type.bind(context).vocabulary
     return zope.component.queryMultiAdapter(
         (context, request, form, field, terms, widget),

Modified: z3c.form/trunk/src/z3c/form/term.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/term.txt	2009-02-10 03:11:12 UTC (rev 96362)
+++ z3c.form/trunk/src/z3c/form/term.txt	2009-02-10 03:34:00 UTC (rev 96363)
@@ -98,7 +98,7 @@
   ...     title=u'Rating',
   ...     vocabulary=ratings)
 
-  >>> terms = term.choice_terms_multiplexer(
+  >>> terms = term.ChoiceTerms(
   ...     None, request, None, ratingField, widget)
   >>> [entry.title for entry in terms]
   [u'bad', u'okay', u'good']
@@ -112,7 +112,7 @@
 
 Initially we get an error because the "Ratings" vocabulary is not defined:
 
-  >>> terms = term.choice_terms_multiplexer(
+  >>> terms = term.ChoiceTerms(
   ...     None, request, None, ratingField2, widget)
   Traceback (most recent call last):
   ...
@@ -129,7 +129,7 @@
 
 We should now be able to get all terms as before:
 
-  >>> terms = term.choice_terms_multiplexer(
+  >>> terms = term.ChoiceTerms(
   ...     None, request, None, ratingField, widget)
   >>> [entry.title for entry in terms]
   [u'bad', u'okay', u'good']
@@ -163,7 +163,7 @@
 register some adapters before using it:
 
   >>> from z3c.form import term
-  >>> zope.component.provideAdapter(term.collection_terms_multiplexer)
+  >>> zope.component.provideAdapter(term.CollectionTerms)
   >>> zope.component.provideAdapter(term.CollectionTermsVocabulary)
   >>> zope.component.provideAdapter(term.CollectionTermsSource)
 
@@ -171,7 +171,7 @@
   ...     title=u'Ratings',
   ...     value_type=ratingField)
 
-  >>> terms = term.collection_terms_multiplexer(
+  >>> terms = term.CollectionTerms(
   ...     None, request, None, ratingsField, widget)
   >>> [entry.title for entry in terms]
   [u'bad', u'okay', u'good']
@@ -220,7 +220,7 @@
 We connect the field to a widget to see the ITerms adapter for sources
 at work:
 
-  >>> terms = term.choice_terms_multiplexer(
+  >>> terms = term.ChoiceTerms(
   ...     None, request, None, sourceRatingField, widget)
 
 Iterating over the terms adapter returnes the term objects:
@@ -259,7 +259,7 @@
   ...     title=u'Sourced Ratings',
   ...     value_type=sourceRatingField)
 
-  >>> terms = term.collection_terms_multiplexer(
+  >>> terms = term.CollectionTerms(
   ...     None, request, None, sourceRatingsField, widget)
   >>> [entry.title for entry in terms]
   [u'ugly', u'nice', u'great']
@@ -309,7 +309,7 @@
 
   >>> rating_context = RatingContext()
   >>> rating_context.base_value = 100
-  >>> terms = term.choice_terms_multiplexer(
+  >>> terms = term.ChoiceTerms(
   ...     rating_context, request, None, contextualSourceRatingField, widget)
 
 Iterating over the terms adapter returnes the term objects:
@@ -348,7 +348,7 @@
   ...     title=u'Contextual Sourced Ratings',
   ...     value_type=contextualSourceRatingField)
 
-  >>> terms = term.collection_terms_multiplexer(
+  >>> terms = term.CollectionTerms(
   ...     rating_context, request, None, contextualSourceRatingsField, widget)
   >>> [entry.title for entry in terms]
   [u'ugly', u'nice', u'great']

Modified: z3c.form/trunk/src/z3c/form/testing.py
===================================================================
--- z3c.form/trunk/src/z3c/form/testing.py	2009-02-10 03:11:12 UTC (rev 96362)
+++ z3c.form/trunk/src/z3c/form/testing.py	2009-02-10 03:34:00 UTC (rev 96363)
@@ -328,10 +328,10 @@
     zope.component.provideAdapter(converter.TimedeltaDataConverter)
     # Adapter for providing terms to radio list and other widgets
     zope.component.provideAdapter(term.BoolTerms)
-    zope.component.provideAdapter(term.choice_terms_multiplexer)
+    zope.component.provideAdapter(term.ChoiceTerms)
     zope.component.provideAdapter(term.ChoiceTermsVocabulary)
     zope.component.provideAdapter(term.ChoiceTermsSource)
-    zope.component.provideAdapter(term.collection_terms_multiplexer)
+    zope.component.provideAdapter(term.CollectionTerms)
     zope.component.provideAdapter(term.CollectionTermsVocabulary)
     zope.component.provideAdapter(term.CollectionTermsSource)
     # Adapter to create an action from a button

Modified: z3c.form/trunk/src/z3c/form/widget.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/widget.txt	2009-02-10 03:11:12 UTC (rev 96362)
+++ z3c.form/trunk/src/z3c/form/widget.txt	2009-02-10 03:34:00 UTC (rev 96363)
@@ -502,7 +502,7 @@
 
   >>> from z3c.form import term
   >>> zope.component.provideAdapter(term.ChoiceTermsVocabulary)
-  >>> zope.component.provideAdapter(term.choice_terms_multiplexer)
+  >>> zope.component.provideAdapter(term.ChoiceTerms)
 
   >>> seqWidget.update()
   >>> seqWidget.terms



More information about the Checkins mailing list