[Checkins] SVN: zc.extjs/branches/dev/src/zc/extjs/ Renamed the widget _toValue method to value and made it public.

Jim Fulton jim at zope.com
Thu Apr 3 18:39:18 EDT 2008


Log message for revision 85087:
  Renamed the widget _toValue method to value and made it public.
  

Changed:
  U   zc.extjs/branches/dev/src/zc/extjs/CHANGES.txt
  U   zc.extjs/branches/dev/src/zc/extjs/interfaces.py
  U   zc.extjs/branches/dev/src/zc/extjs/widgets.py
  U   zc.extjs/branches/dev/src/zc/extjs/widgets.txt

-=-
Modified: zc.extjs/branches/dev/src/zc/extjs/CHANGES.txt
===================================================================
--- zc.extjs/branches/dev/src/zc/extjs/CHANGES.txt	2008-04-03 21:56:48 UTC (rev 85086)
+++ zc.extjs/branches/dev/src/zc/extjs/CHANGES.txt	2008-04-03 22:39:17 UTC (rev 85087)
@@ -15,6 +15,12 @@
 - Support for "live search" combo boxes that make ajax calls to update
   results as people refine searches.
 
+
+0.2.0 (2008-04-03)
+==================
+
+Renamed the widget _toValue method to value and made it public.
+
 0.1 (2008-03-??)
 ================
 

Modified: zc.extjs/branches/dev/src/zc/extjs/interfaces.py
===================================================================
--- zc.extjs/branches/dev/src/zc/extjs/interfaces.py	2008-04-03 21:56:48 UTC (rev 85086)
+++ zc.extjs/branches/dev/src/zc/extjs/interfaces.py	2008-04-03 22:39:17 UTC (rev 85087)
@@ -50,3 +50,7 @@
         value passed in is a missing value.
         """
 
+    def value(raw):
+        """Convert a raw value, from a form, to an application value
+        """
+

Modified: zc.extjs/branches/dev/src/zc/extjs/widgets.py
===================================================================
--- zc.extjs/branches/dev/src/zc/extjs/widgets.py	2008-04-03 21:56:48 UTC (rev 85086)
+++ zc.extjs/branches/dev/src/zc/extjs/widgets.py	2008-04-03 22:39:17 UTC (rev 85087)
@@ -62,7 +62,10 @@
             return None
         return unicode(v)
 
-    def _toValue(self, v):
+    def value(self, raw):
+        return self._toValue(raw)
+    
+    def _toValue(self, v):              # for backward compat for a while
         return v
 
     def hasInput(self):
@@ -87,7 +90,7 @@
             else:
                 return self.context.missing_value
             
-        value = self._toValue(raw)
+        value = self.value(raw)
         
         # value must be valid per the field constraints
         try:
@@ -174,7 +177,7 @@
             )
         return terms.getTerm(v).token
 
-    def _toValue(self, v):
+    def value(self, v):
         terms = zope.component.getMultiAdapter(
             (self.source, self.request),
             zope.app.form.browser.interfaces.ITerms,
@@ -208,7 +211,7 @@
             return None
         return self.source.getTerm(v).token
 
-    def _toValue(self, v):
+    def value(self, v):
         return self.source.getTermByToken(v).value
             
 class InputInt(Base):
@@ -235,7 +238,7 @@
     def _is_missing(self, raw):
         return not raw
 
-    def _toValue(self, v):
+    def value(self, v):
         try:
             return int(v)
         except:
@@ -264,7 +267,7 @@
     def _toForm(self, v):
         return str(v)
 
-    def _toValue(self, v):
+    def value(self, v):
         try:
             return decimal.Decimal(v)
         except decimal.InvalidOperation:

Modified: zc.extjs/branches/dev/src/zc/extjs/widgets.txt
===================================================================
--- zc.extjs/branches/dev/src/zc/extjs/widgets.txt	2008-04-03 21:56:48 UTC (rev 85086)
+++ zc.extjs/branches/dev/src/zc/extjs/widgets.txt	2008-04-03 22:39:17 UTC (rev 85087)
@@ -36,7 +36,7 @@
       Convert an application value to a value that can be marshaled to
       JSON and used to initialize the Ext widget.
 
-  _toValue(v)
+  value(v)
       Convert a raw value sent from the client to an application value.
   
   _is_missing(self, v)
@@ -115,7 +115,7 @@
 
 Let's try overriding some methods:
 
-    >>> w._toValue = lambda raw: raw+' cooked'
+    >>> w.value = lambda raw: raw+' cooked'
     >>> w.formValue = lambda v: v[:-7]
     >>> w._is_missing = lambda raw: raw == u'xxx'
 



More information about the Checkins mailing list