source:
ralphm-patches/pubsub-default-type-attribute.patch
Last change on this file was 57:0d8b6cf41728, checked in by Ralph Meijer <ralphm@…>, 10 years ago | |
---|---|
File size: 2.5 KB |
-
wokkel/pubsub.py
# HG changeset patch # Parent a1fb8edead3376a4c5ec2f75f1922aaf7af3c8c8 diff -r a1fb8edead33 wokkel/pubsub.py
a b 424 424 """ 425 425 Parse node type out of a request for the default node configuration. 426 426 """ 427 form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG) 428 if form is not None and form.formType == 'submit': 429 values = form.getValues() 430 self.nodeType = values.get('pubsub#node_type', 'leaf') 431 else: 432 self.nodeType = 'leaf' 427 self.nodeType = verbElement.getAttribute('type', u'leaf') 433 428 434 429 435 430 def _parse_configure(self, verbElement): -
wokkel/test/test_pubsub.py
diff -r a1fb8edead33 wokkel/test/test_pubsub.py
a b 1712 1712 <iq type='get' to='pubsub.example.org' 1713 1713 from='user@example.org'> 1714 1714 <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> 1715 <default> 1716 <x xmlns='jabber:x:data' type='submit'> 1717 <field var='FORM_TYPE' type='hidden'> 1718 <value>http://jabber.org/protocol/pubsub#node_config</value> 1719 </field> 1720 <field var='pubsub#node_type'> 1721 <value>collection</value> 1722 </field> 1723 </x> 1724 </default> 1725 1715 <default type='collection'/> 1726 1716 </pubsub> 1727 1717 </iq> 1728 1718 """ … … 2692 2682 return fieldDefs 2693 2683 2694 2684 def default(request): 2685 self.assertEquals(u'leaf', request.nodeType) 2695 2686 return defer.succeed({'pubsub#persist_items': 'false', 2696 2687 'x-myfield': '1'}) 2697 2688 … … 2725 2716 <iq type='get' to='pubsub.example.org' 2726 2717 from='user@example.org'> 2727 2718 <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> 2728 <default> 2729 <x xmlns='jabber:x:data' type='submit'> 2730 <field var='FORM_TYPE' type='hidden'> 2731 <value>http://jabber.org/protocol/pubsub#node_config</value> 2732 </field> 2733 <field var='pubsub#node_type'> 2734 <value>unknown</value> 2735 </field> 2736 </x> 2737 </default> 2738 2719 <default type='unknown'/> 2739 2720 </pubsub> 2740 2721 </iq> 2741 2722 """
Note: See TracBrowser
for help on using the repository browser.