Changeset 26:59ace4d1df68 in ralphm-patches


Ignore:
Timestamp:
Jan 1, 2010, 4:18:52 PM (10 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Clean up patches, more tests, adjust copyright statements to new year.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • findform.patch

    r21 r26  
    1 diff -r 031a0ad83156 -r fda6b92d81a1 wokkel/data_form.py
    2 --- a/wokkel/data_form.py       Wed Dec 30 21:37:33 2009 +0100
    3 +++ b/wokkel/data_form.py       Wed Dec 30 21:39:55 2009 +0100
    4 @@ -616,3 +616,24 @@
     1Move findForm to wokkel.data_form
     2
     3diff -r ff70bda5117e wokkel/data_form.py
     4--- a/wokkel/data_form.py       Fri Jan 01 16:03:51 2010 +0100
     5+++ b/wokkel/data_form.py       Fri Jan 01 16:16:09 2010 +0100
     6@@ -657,3 +657,24 @@
    57 
    68         for field in filtered:
     
    2729+
    2830+    return None
    29 diff -r 031a0ad83156 -r fda6b92d81a1 wokkel/pubsub.py
    30 --- a/wokkel/pubsub.py  Wed Dec 30 21:37:33 2009 +0100
    31 +++ b/wokkel/pubsub.py  Wed Dec 30 21:39:55 2009 +0100
     31diff -r ff70bda5117e wokkel/pubsub.py
     32--- a/wokkel/pubsub.py  Fri Jan 01 16:03:51 2010 +0100
     33+++ b/wokkel/pubsub.py  Fri Jan 01 16:16:09 2010 +0100
    3234@@ -252,30 +252,6 @@
    3335         self.verb = verb
     
    7779+        form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
    7880         if form:
    79              if form.formType in ('submit', 'cancel'):
    80                  self.options = form
    81 @@ -435,7 +411,7 @@
     81             if form.formType == 'submit':
     82                 self.options = form.getValues()
     83@@ -437,7 +413,7 @@
    8284 
    8385 
     
    8688+        form = data_form.findForm(verbElement, NS_PUBSUB_SUBSCRIBE_OPTIONS)
    8789         if form:
    88              if form.formType not in ('submit', 'cancel'):
    89                  raise BadRequest(text="Unexpected form type %r" % form.formType)
     90             if form.formType == 'submit':
     91                 self.options = form.getValues()
  • form-missing-tests.patch

    r24 r26  
     1Add missing tests for Data Forms and correct some minor issues.
     2
    13diff -r 3ef9bc7a0d70 wokkel/data_form.py
    24--- a/wokkel/data_form.py       Wed Dec 30 16:53:05 2009 +0100
    3 +++ b/wokkel/data_form.py       Fri Jan 01 01:21:56 2010 +0100
     5+++ b/wokkel/data_form.py       Fri Jan 01 15:54:26 2010 +0100
     6@@ -1,6 +1,6 @@
     7 # -*- test-case-name: wokkel.test.test_data_form -*-
     8 #
     9-# Copyright (c) 2003-2009 Ralph Meijer
     10+# Copyright (c) 2003-2010 Ralph Meijer
     11 # See LICENSE for details.
     12 
     13 """
    414@@ -251,10 +251,10 @@
    515             field['var'] = self.var
     
    112122diff -r 3ef9bc7a0d70 wokkel/test/test_data_form.py
    113123--- a/wokkel/test/test_data_form.py     Wed Dec 30 16:53:05 2009 +0100
    114 +++ b/wokkel/test/test_data_form.py     Fri Jan 01 01:21:56 2010 +0100
    115 @@ -19,14 +19,67 @@
     124+++ b/wokkel/test/test_data_form.py     Fri Jan 01 15:54:26 2010 +0100
     125@@ -1,4 +1,4 @@
     126-# Copyright (c) 2003-2009 Ralph Meijer
     127+# Copyright (c) 2003-2010 Ralph Meijer
     128 # See LICENSE for details.
     129 
     130 """
     131@@ -19,14 +19,73 @@
    116132     """
    117133 
    118134     def test_toElement(self):
     135+        """
     136+        An option is an option element with a value child with the option value.
     137+        """
    119138+        option = data_form.Option('value')
    120139+        element = option.toElement()
     
    128147+
    129148+    def test_toElementLabel(self):
     149+        """
     150+        A label is rendered as an attribute on the option element.
     151+        """
    130152         option = data_form.Option('value', 'label')
    131153         element = option.toElement()
     
    187209 
    188210 
    189 @@ -44,6 +97,21 @@
     211@@ -44,6 +103,21 @@
    190212         self.assertEqual('test', field.var)
    191213 
     
    209231         """
    210232         Test rendering to a DOM.
    211 @@ -130,12 +198,44 @@
     233@@ -130,12 +204,44 @@
    212234 
    213235 
     
    254276         """
    255277         A field not of type fixed must have a var.
    256 @@ -250,6 +350,7 @@
     278@@ -250,6 +356,7 @@
    257279         field = data_form.Field.fromElement(element)
    258280         self.assertEquals(u'user@example.org', field.value)
     
    262284         """
    263285         Parsed jid-single field values should be of type C{unicode}.
    264 @@ -275,6 +376,85 @@
     286@@ -275,6 +382,85 @@
    265287         self.assertEquals(u'false', field.value)
    266288 
     
    348370 class FormTest(unittest.TestCase):
    349371     """
    350 @@ -289,11 +469,13 @@
     372@@ -289,6 +475,7 @@
    351373         form = data_form.Form('result')
    352374         self.assertEqual('result', form.formType)
     
    356378         """
    357379         The toElement method returns a form's DOM representation.
    358          """
    359          form = data_form.Form('result')
    360 +
    361          element = form.toElement()
    362  
    363          self.assertTrue(domish.IElement.providedBy(element))
    364 @@ -303,6 +485,105 @@
     380@@ -303,6 +490,105 @@
    365381         self.assertEquals([], element.children)
    366382 
     
    468484         """
    469485         C{fromElement} creates a L{data_form.Form} from a DOM representation.
    470 @@ -348,6 +629,7 @@
     486@@ -348,6 +634,7 @@
    471487 
    472488         self.assertEquals(['instruction'], form.instructions)
     
    476492         element = domish.Element((NS_X_DATA, 'x'))
    477493         element.addElement('instructions', content='instruction 1')
    478 @@ -377,3 +659,173 @@
     494@@ -377,3 +664,173 @@
    479495         self.assertEquals('field1', form.fieldList[0].var)
    480496         self.assertIn('field2', form.fields)
  • pubsub-forms.patch

    r25 r26  
    1 diff -r bf2fb205fe5a wokkel/data_form.py
    2 --- a/wokkel/data_form.py       Fri Jan 01 01:28:11 2010 +0100
    3 +++ b/wokkel/data_form.py       Fri Jan 01 01:29:23 2010 +0100
     1Move makeFields to wokkel.data_form, add form type checking.
     2
     3diff -r ba58db23e8b9 wokkel/data_form.py
     4--- a/wokkel/data_form.py       Fri Jan 01 15:54:26 2010 +0100
     5+++ b/wokkel/data_form.py       Fri Jan 01 16:16:57 2010 +0100
    46@@ -76,6 +76,7 @@
    57             option['label'] = self.label
     
    2729         """
    2830         Return the DOM representation of this Field.
    29 @@ -322,16 +324,16 @@
     31@@ -322,16 +324,24 @@
    3032 
    3133 
     
    3436-        kwargs = dictionary.copy()
    3537+    def fromDict(fieldDict):
    36 +        kwargs = fieldDict.copy()
     38+        """
     39+        Create a field from a dictionary.
    3740 
    3841-        if 'type' in dictionary:
    3942-            kwargs['fieldType'] = dictionary['type']
     43+        This is a short hand for passing arguments directly on Field object
     44+        creation. The field type is represented by the C{'type'} key. For
     45+        C{'options'} the value is not a list of L{Option}s, but a dictionary
     46+        keyed by value, with an optional label as value.
     47+        """
     48+        kwargs = fieldDict.copy()
     49+
    4050+        if 'type' in fieldDict:
    4151+            kwargs['fieldType'] = fieldDict['type']
     
    5060             kwargs['options'] = options
    5161 
    52 @@ -415,7 +417,7 @@
     62@@ -415,7 +425,7 @@
    5363         """
    5464         Add a field to this form.
     
    5969         adding new fields. Multiple fields with the same name are disallowed.
    6070         """
    61 @@ -428,7 +430,71 @@
     71@@ -428,7 +438,85 @@
    6272         self.fieldList.append(field)
    6373 
     
    7888+
    7989+        This creates fields from a mapping of name to value(s) and adds them to
    80 +        this form. If C{fieldDefs} is not C{None}, this is used to fill in
     90+        this form. It is typically used for generating outgoing forms.
     91+
     92+        If C{fieldDefs} is not C{None}, this is used to fill in
    8193+        additional properties of fields, like the field types, labels and
    82 +        possible options. If C{filterUnknown} is C{True} and C{fieldDefs} is
    83 +        not C{None}, fields will only be created from C{values} with a
    84 +        corresponding entry in C{fieldDefs}.
     94+        possible options.
     95+
     96+        If C{filterUnknown} is C{True} and C{fieldDefs} is not C{None}, fields
     97+        will only be created from C{values} with a corresponding entry in
     98+        C{fieldDefs}.
     99+
     100+        If the field type is unknown, the field type is derived from the field
     101+        value. For single values, if the value is a C{bool}, C{'boolean'} s
     102+        used, for L{JID} C{'jid-single'}, and C{'text-single'} otherwise. For
     103+        multiple values, if the first item is a L{JID} C{'jid-multi'} is used.
     104+        Otherwise C{'list-multi'}.
     105+
     106+        Note that the values are used as given, no type coersion or checking
     107+        is performed. Use L{typeCheck} to check types and coerce values of
     108+        fields added to a form.
    85109+
    86110+        @param values: Values to create fields from.
     
    110134+                        fieldDict['type'] = 'jid-multi'
    111135+                    else:
    112 +                        fieldDict['type'] = 'text-multi'
     136+                        fieldDict['type'] = 'list-multi'
    113137+            else:
    114138+                fieldDict['value'] = value
     
    131155         form['type'] = self.formType
    132156 
    133 @@ -516,3 +582,48 @@
     157@@ -516,3 +604,56 @@
    134158             values[name] = value
    135159 
     
    142166+
    143167+        This method walks all named fields to check their values against their
    144 +        type. The field definition in C{fieldDefs} is used to check the field
    145 +        type. Unknown fields are ignored.
    146 +
    147 +        If the field type is C{None} (when not set by the receiving entity),
    148 +        C{'text-single'} is assumed, as this is the default value.
     168+        type, and is typically used for forms received from other entities.The
     169+        field definition in C{fieldDefs} is used to check the field type.
     170+
     171+        If C{filterUnknown} is C{True}, fields that are not present in
     172+        C{fieldDefs} are removed from the form.
     173+
     174+        If the field type is C{None} (when not set by the sending entity),
     175+        the type from the field definitition is used, or C{'text-single'} if
     176+        that is not set.
    149177+
    150178+        @param fieldDefs: Field definitions as a dictionary. See
     
    161189+        for name, field in self.fields.iteritems():
    162190+            if name in fieldDefs:
     191+                fieldDef = fieldDefs[name]
     192+                if 'type' not in fieldDef:
     193+                    fieldDef['type'] = 'text-single'
     194+
    163195+                if field.fieldType is None:
    164 +                    field.fieldType = fieldDefs[name]['type']
    165 +                elif field.fieldType != fieldDefs[name]['type']:
     196+                    field.fieldType = fieldDef['type']
     197+                elif field.fieldType != fieldDef['type']:
    166198+                    raise TypeError("Field type for %r is %r, expected %r" %
    167199+                                    (name,
    168200+                                     field.fieldType,
    169 +                                     fieldDefs[name]['type']))
     201+                                     fieldDef['type']))
    170202+                else:
    171203+                    # Field type is correct
     
    180212+        for field in filtered:
    181213+            self.removeField(field)
    182 diff -r bf2fb205fe5a wokkel/pubsub.py
    183 --- a/wokkel/pubsub.py  Fri Jan 01 01:28:11 2010 +0100
    184 +++ b/wokkel/pubsub.py  Fri Jan 01 01:29:23 2010 +0100
     214diff -r ba58db23e8b9 wokkel/pubsub.py
     215--- a/wokkel/pubsub.py  Fri Jan 01 15:54:26 2010 +0100
     216+++ b/wokkel/pubsub.py  Fri Jan 01 16:16:57 2010 +0100
     217@@ -1,6 +1,6 @@
     218 # -*- test-case-name: wokkel.test.test_pubsub -*-
     219 #
     220-# Copyright (c) 2003-2009 Ralph Meijer
     221+# Copyright (c) 2003-2010 Ralph Meijer
     222 # See LICENSE for details.
     223 
     224 """
    185225@@ -1012,29 +1012,11 @@
    186226             return None
     
    216256 
    217257 
    218 diff -r bf2fb205fe5a wokkel/test/test_data_form.py
    219 --- a/wokkel/test/test_data_form.py     Fri Jan 01 01:28:11 2010 +0100
    220 +++ b/wokkel/test/test_data_form.py     Fri Jan 01 01:29:23 2010 +0100
    221 @@ -782,6 +782,45 @@
     258diff -r ba58db23e8b9 wokkel/test/test_data_form.py
     259--- a/wokkel/test/test_data_form.py     Fri Jan 01 15:54:26 2010 +0100
     260+++ b/wokkel/test/test_data_form.py     Fri Jan 01 16:16:57 2010 +0100
     261@@ -787,6 +787,128 @@
    222262         self.assertRaises(data_form.Error, form.addField, field2)
    223263 
     
    245285+
    246286+
    247 +    def test_makeFieldsJID(self):
     287+    def test_makeField(self):
     288+        """
     289+        Fields can be created from a dict of values and a dict of field defs.
     290+        """
     291+        fieldDefs = {
     292+                "pubsub#persist_items":
     293+                    {"type": "boolean",
     294+                     "label": "Persist items to storage"},
     295+                "pubsub#deliver_payloads":
     296+                    {"type": "boolean",
     297+                     "label": "Deliver payloads with event notifications"},
     298+                "pubsub#creator":
     299+                    {"type": "jid-single",
     300+                     "label": "The JID of the node creator"},
     301+                "pubsub#description":
     302+                    {"type": "text-single",
     303+                     "label": "A description of the node"},
     304+                "pubsub#owner":
     305+                    {"type": "jid-single",
     306+                     "label": "Owner of the node"},
     307+                }
     308+        values = {'pubsub#deliver_payloads': '0',
     309+                  'pubsub#persist_items': True,
     310+                  'pubsub#description': 'a great node',
     311+                  'pubsub#owner': jid.JID('user@example.org'),
     312+                  'x-myfield': ['a', 'b']}
     313+
     314+        form = data_form.Form('submit')
     315+        form.makeFields(values, fieldDefs)
     316+
     317+        # Check that the expected fields have been created
     318+        self.assertIn('pubsub#deliver_payloads', form.fields)
     319+        self.assertIn('pubsub#persist_items', form.fields)
     320+        self.assertIn('pubsub#description', form.fields)
     321+        self.assertIn('pubsub#owner', form.fields)
     322+
     323+        # This field is not created because there is no value for it.
     324+        self.assertNotIn('pubsub#creator', form.fields)
     325+
     326+        # This field is not created because it does not appear in fieldDefs
     327+        self.assertNotIn('x-myfield', form.fields)
     328+
     329+        # Check properties the created fields
     330+        self.assertEqual('boolean',
     331+                         form.fields['pubsub#deliver_payloads'].fieldType)
     332+        self.assertEqual('0',
     333+                         form.fields['pubsub#deliver_payloads'].value)
     334+        self.assertEqual('Deliver payloads with event notifications',
     335+                         form.fields['pubsub#deliver_payloads'].label)
     336+        self.assertEqual(True,
     337+                         form.fields['pubsub#persist_items'].value)
     338+
     339+
     340+
     341+
     342+    def test_makeFieldsUnknownTypeJID(self):
     343+        """
     344+        Without type, a single JID value sets field type jid-single.
     345+        """
    248346+        values = {'pubsub#creator': jid.JID('user@example.org')}
    249347+        form = data_form.Form('result')
     
    253351+
    254352+
    255 +    def test_makeFieldsJIDMulti(self):
     353+    def test_makeFieldsUnknownTypeJIDMulti(self):
     354+        """
     355+        Without type, multiple JID values sets field type jid-multi.
     356+        """
    256357+        values = {'pubsub#contact': [jid.JID('user@example.org'),
    257358+                                     jid.JID('other@example.org')]}
     
    262363+
    263364+
     365+    def test_makeFieldsUnknownTypeBoolean(self):
     366+        """
     367+        Without type, a boolean value sets field type boolean.
     368+        """
     369+        values = {'pubsub#persist_items': True}
     370+        form = data_form.Form('result')
     371+        form.makeFields(values)
     372+        field = form.fields['pubsub#persist_items']
     373+        self.assertEqual('boolean', field.fieldType)
     374+
     375+
     376+    def test_makeFieldsUnknownTypeListMulti(self):
     377+        """
     378+        Without type, multiple values sets field type list-multi.
     379+        """
     380+        values = {'pubsub#show-values': ['chat', 'online', 'away']}
     381+        form = data_form.Form('result')
     382+        form.makeFields(values)
     383+        field = form.fields['pubsub#show-values']
     384+        self.assertEqual('list-multi', field.fieldType)
     385+
     386+
    264387     def test_getValues(self):
    265388         """
    266389         Each named field is represented in the values, keyed by name.
     390@@ -834,3 +956,111 @@
     391         form = data_form.Form('submit', fields=fields)
     392         values = form.getValues()
     393         self.assertEqual({'features': 'news'}, values)
     394+
     395+
     396+    def test_typeCheckKnownFieldChecked(self):
     397+        """
     398+        Known fields are type checked.
     399+        """
     400+        checked = []
     401+        fieldDefs = {"pubsub#description":
     402+                        {"type": "text-single",
     403+                         "label": "A description of the node"}}
     404+        form = data_form.Form('submit')
     405+        form.addField(data_form.Field(var='pubsub#description',
     406+                                      value='a node'))
     407+        field = form.fields['pubsub#description']
     408+        field.typeCheck = lambda : checked.append(None)
     409+        form.typeCheck(fieldDefs)
     410+
     411+        self.assertEqual([None], checked)
     412+
     413+
     414+    def test_typeCheckKnownFieldNoType(self):
     415+        """
     416+        Known fields without a type get the type of the field definition.
     417+        """
     418+        checked = []
     419+        fieldDefs = {"pubsub#description":
     420+                        {"type": "text-single",
     421+                         "label": "A description of the node"}}
     422+        form = data_form.Form('submit')
     423+        form.addField(data_form.Field(None, var='pubsub#description',
     424+                                            value='a node'))
     425+        field = form.fields['pubsub#description']
     426+        field.typeCheck = lambda : checked.append(None)
     427+        form.typeCheck(fieldDefs)
     428+
     429+        self.assertEqual('text-single', field.fieldType)
     430+        self.assertEqual([None], checked)
     431+
     432+
     433+    def test_typeCheckWrongFieldType(self):
     434+        """
     435+        A field should have the same type as the field definition.
     436+        """
     437+        checked = []
     438+        fieldDefs = {"pubsub#description":
     439+                        {"type": "text-single",
     440+                         "label": "A description of the node"}}
     441+        form = data_form.Form('submit')
     442+        form.addField(data_form.Field('list-single', var='pubsub#description',
     443+                                                     value='a node'))
     444+        field = form.fields['pubsub#description']
     445+        field.typeCheck = lambda : checked.append(None)
     446+
     447+        self.assertRaises(TypeError, form.typeCheck, fieldDefs)
     448+        self.assertEqual([], checked)
     449+
     450+
     451+    def test_typeCheckDefaultTextSingle(self):
     452+        """
     453+        If a field definition has no type, use text-single.
     454+        """
     455+        checked = []
     456+        fieldDefs = {"pubsub#description":
     457+                        {"label": "A description of the node"}}
     458+        form = data_form.Form('submit')
     459+        form.addField(data_form.Field('text-single', var='pubsub#description',
     460+                                                     value='a node'))
     461+        field = form.fields['pubsub#description']
     462+        field.typeCheck = lambda : checked.append(None)
     463+        form.typeCheck(fieldDefs)
     464+
     465+        self.assertEqual([None], checked)
     466+
     467+
     468+    def test_typeCheckUnknown(self):
     469+        """
     470+        Unkown fields are not checked, but not removed if filterUnknown False.
     471+        """
     472+        checked = []
     473+        fieldDefs = {}
     474+        form = data_form.Form('submit')
     475+        form.addField(data_form.Field('list-single', var='pubsub#description',
     476+                                                     value='a node'))
     477+        field = form.fields['pubsub#description']
     478+        field.typeCheck = lambda : checked.append(None)
     479+        form.typeCheck(fieldDefs, filterUnknown=False)
     480+
     481+        self.assertIn('pubsub#description', form.fields)
     482+        self.assertEqual([], checked)
     483+
     484+
     485+    def test_typeCheckUnknownRemoved(self):
     486+        """
     487+        Unkown fields are not checked, and removed if filterUnknown True.
     488+        """
     489+        checked = []
     490+        fieldDefs = {}
     491+        form = data_form.Form('submit')
     492+        form.addField(data_form.Field('list-single', var='pubsub#description',
     493+                                                     value='a node'))
     494+        field = form.fields['pubsub#description']
     495+        field.typeCheck = lambda : checked.append(None)
     496+        form.typeCheck(fieldDefs, filterUnknown=True)
     497+
     498+        self.assertNotIn('pubsub#description', form.fields)
     499+        self.assertEqual([], checked)
     500+
     501+
  • pubsub-item.patch

    r18 r26  
    1 diff -r 2919e60d3588 -r 90bd422b8ac6 wokkel/pubsub.py
    2 --- a/wokkel/pubsub.py  Mon Dec 28 12:13:34 2009 +0100
    3 +++ b/wokkel/pubsub.py  Mon Dec 28 21:19:34 2009 +0100
     1diff -r e58b9f2cf8a3 wokkel/pubsub.py
     2--- a/wokkel/pubsub.py  Fri Jan 01 01:34:14 2010 +0100
     3+++ b/wokkel/pubsub.py  Fri Jan 01 11:12:36 2010 +0100
    44@@ -119,33 +119,47 @@
    55 
     
    4141+        L{Item} is usable in all contexts involving items.
    4242+
    43 +        @param namespace: The namespace of the item. Usually L{'NS_PUBSUB'} or
    44 +            L{'NS_PUBSUB_EVENT'}.
    45 +        @type: C{unicode}.
    46 +        @rtype: L{domish.Element}.
     43+        @param namespace: The namespace of the item. Usually L{NS_PUBSUB} or
     44+            L{NS_PUBSUB_EVENT}.
     45+        @type: C{unicode}
     46+        @rtype: L{domish.Element}
    4747         """
    4848+        element = domish.Element((namespace, 'item'))
     
    6868 
    6969 
    70 @@ -333,7 +347,13 @@
     70@@ -309,7 +323,13 @@
    7171         self.items = []
    7272         for element in verbElement.elements():
     
    8383 
    8484     def _render_items(self, verbElement):
    85 @@ -342,7 +362,7 @@
     85@@ -318,7 +338,7 @@
    8686         """
    8787         if self.items:
     
    9292 
    9393     def _parse_jid(self, verbElement):
    94 @@ -1105,7 +1125,7 @@
     94@@ -1124,7 +1144,7 @@
    9595         items["node"] = request.nodeIdentifier
    9696 
     
    101101         return response
    102102 
    103 diff -r 2919e60d3588 -r 90bd422b8ac6 wokkel/test/test_pubsub.py
    104 --- a/wokkel/test/test_pubsub.py        Mon Dec 28 12:13:34 2009 +0100
    105 +++ b/wokkel/test/test_pubsub.py        Mon Dec 28 21:19:34 2009 +0100
    106 @@ -331,7 +331,6 @@
     103diff -r e58b9f2cf8a3 wokkel/test/test_pubsub.py
     104--- a/wokkel/test/test_pubsub.py        Fri Jan 01 01:34:14 2010 +0100
     105+++ b/wokkel/test/test_pubsub.py        Fri Jan 01 11:12:36 2010 +0100
     106@@ -365,7 +365,6 @@
    107107         items = list(domish.generateElementsQNamed(child.children,
    108108                                                    'item', NS_PUBSUB))
     
    112112         response = toResponse(iq, 'result')
    113113         self.stub.send(response)
    114 @@ -634,8 +633,8 @@
     114@@ -699,8 +698,8 @@
    115115 
    116116         request = pubsub.PubSubRequest.fromElement(parseXml(xml))
  • pubsub-request-options-form.patch

    r21 r26  
    1 diff -r 438b64816faa -r 4d1379394cda wokkel/pubsub.py
    2 --- a/wokkel/pubsub.py  Wed Dec 30 21:22:36 2009 +0100
    3 +++ b/wokkel/pubsub.py  Wed Dec 30 21:29:15 2009 +0100
    4 @@ -380,10 +380,8 @@
    5          """
    6          form = PubSubRequest._findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
     1diff -r 459a78aaec20 wokkel/pubsub.py
     2--- a/wokkel/pubsub.py  Fri Jan 01 16:17:05 2010 +0100
     3+++ b/wokkel/pubsub.py  Fri Jan 01 16:17:28 2010 +0100
     4@@ -356,10 +356,8 @@
     5         """
     6         form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
    77         if form:
    88-            if form.formType == 'submit':
     
    1515                 raise BadRequest(text="Unexpected form type %r" % form.formType)
    1616         else:
    17 @@ -439,12 +437,9 @@
     17@@ -415,12 +413,9 @@
    1818     def _parse_options(self, verbElement):
    19          form = PubSubRequest._findForm(verbElement, NS_PUBSUB_SUBSCRIBE_OPTIONS)
     19         form = data_form.findForm(verbElement, NS_PUBSUB_SUBSCRIBE_OPTIONS)
    2020         if form:
    2121-            if form.formType == 'submit':
     
    3030             raise BadRequest(text="Missing options form")
    3131 
    32 @@ -956,6 +951,8 @@
     32@@ -932,6 +927,8 @@
    3333             handlerName, argNames = self._legacyHandlers[request.verb]
    3434             handler = getattr(self, handlerName)
     
    3939 
    4040         # If needed, translate the result into a response
    41 @@ -1020,29 +1017,9 @@
     41@@ -996,29 +993,9 @@
    4242         return form
    4343 
     
    7272 
    7373     def _preProcess_default(self, resource, request):
    74 @@ -1073,12 +1050,11 @@
     74@@ -1049,12 +1026,11 @@
    7575 
    7676 
     
    8989 
    9090     def _toResponse_items(self, result, resource, request):
    91 diff -r 438b64816faa -r 4d1379394cda wokkel/test/test_pubsub.py
    92 --- a/wokkel/test/test_pubsub.py        Wed Dec 30 21:22:36 2009 +0100
    93 +++ b/wokkel/test/test_pubsub.py        Wed Dec 30 21:29:15 2009 +0100
     91diff -r 459a78aaec20 wokkel/test/test_pubsub.py
     92--- a/wokkel/test/test_pubsub.py        Fri Jan 01 16:17:05 2010 +0100
     93+++ b/wokkel/test/test_pubsub.py        Fri Jan 01 16:17:28 2010 +0100
     94@@ -1,4 +1,4 @@
     95-# Copyright (c) 2003-2009 Ralph Meijer
     96+# Copyright (c) 2003-2010 Ralph Meijer
     97 # See LICENSE for details.
     98 
     99 """
    94100@@ -805,7 +805,7 @@
    95101         self.assertEqual(JID('pubsub.example.org'), request.recipient)
  • series

    r24 r26  
    11form-missing-tests.patch
    22pubsub-forms.patch
     3findform.patch
    34pubsub-request-options-form.patch
    4 findform.patch
    55pubsub-subscription-options.patch
    66pubsub-create-configure.patch
Note: See TracChangeset for help on using the changeset viewer.