Changeset 24:8116c2eaa96a in ralphm-patches for pubsub-forms.patch


Ignore:
Timestamp:
Jan 1, 2010, 1:24:04 AM (11 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

More tests, integrate form-coerce-values.patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pubsub-forms.patch

    r22 r24  
    1 diff -r 5ccaacff8028 wokkel/data_form.py
    2 --- a/wokkel/data_form.py       Thu Dec 31 14:34:48 2009 +0100
    3 +++ b/wokkel/data_form.py       Thu Dec 31 14:36:22 2009 +0100
     1diff -r 7ec54fd678fc wokkel/data_form.py
     2--- a/wokkel/data_form.py       Fri Jan 01 01:21:56 2010 +0100
     3+++ b/wokkel/data_form.py       Fri Jan 01 01:22:24 2010 +0100
    44@@ -76,6 +76,7 @@
    55             option['label'] = self.label
     
    2828         Return the DOM representation of this Field.
    2929@@ -256,7 +258,7 @@
    30              elif self.fieldType in ('jid-single', 'jid-multi'):
    31                  value = value.full()
     30             else:
     31                 value = unicode(value)
    3232 
    3333-            field.addElement('value', content=value)
     
    140140         form['type'] = self.formType
    141141 
    142 @@ -489,7 +555,17 @@
    143  
    144          return form
    145  
    146 +
    147      def getValues(self):
    148 +        """
    149 +        Extract values from the named form fields.
    150 +
    151 +        For all named fields, the corresponding value or values are
    152 +        returned in a dictionary keyed by the field name. For multi-value
    153 +        fields, the dictionary value is a list, otherwise a single value.
    154 +
    155 +        @rtype: C{dict}
    156 +        """
    157          values = {}
    158  
    159          for name, field in self.fields.iteritems():
    160 @@ -501,3 +577,48 @@
     142@@ -516,3 +582,48 @@
    161143             values[name] = value
    162144 
     
    207189+        for field in filtered:
    208190+            self.removeField(field)
    209 diff -r 5ccaacff8028 wokkel/pubsub.py
    210 --- a/wokkel/pubsub.py  Thu Dec 31 14:34:48 2009 +0100
    211 +++ b/wokkel/pubsub.py  Thu Dec 31 14:36:22 2009 +0100
     191diff -r 7ec54fd678fc wokkel/pubsub.py
     192--- a/wokkel/pubsub.py  Fri Jan 01 01:21:56 2010 +0100
     193+++ b/wokkel/pubsub.py  Fri Jan 01 01:22:24 2010 +0100
    212194@@ -1012,29 +1012,11 @@
    213195             return None
     
    243225 
    244226 
    245 diff -r 5ccaacff8028 wokkel/test/test_data_form.py
    246 --- a/wokkel/test/test_data_form.py     Thu Dec 31 14:34:48 2009 +0100
    247 +++ b/wokkel/test/test_data_form.py     Thu Dec 31 14:36:22 2009 +0100
    248 @@ -544,3 +544,42 @@
    249          field2 = data_form.Field(var='test', value='value2')
    250          form.addField(field1)
     227diff -r 7ec54fd678fc wokkel/test/test_data_form.py
     228--- a/wokkel/test/test_data_form.py     Fri Jan 01 01:21:56 2010 +0100
     229+++ b/wokkel/test/test_data_form.py     Fri Jan 01 01:22:24 2010 +0100
     230@@ -782,6 +782,45 @@
    251231         self.assertRaises(data_form.Error, form.addField, field2)
    252 +
    253 +
     232 
     233 
    254234+    def test_removeField(self):
    255235+        """
     
    289269+        field = form.fields['pubsub#contact']
    290270+        self.assertEqual('jid-multi', field.fieldType)
     271+
     272+
     273     def test_getValues(self):
     274         """
     275         Each named field is represented in the values, keyed by name.
Note: See TracChangeset for help on using the changeset viewer.