source:
ralphm-patches/pubsub-default-type-attribute.patch
@
54:03ec57713c90
Last change on this file since 54:03ec57713c90 was 47:f6d222b68f1c, checked in by Ralph Meijer <ralphm@…>, 11 years ago | |
---|---|
File size: 2.5 KB |
-
wokkel/pubsub.py
# HG changeset patch # Parent fc34b2a3eee92201a08dd633aeccf75724305c88 diff -r fc34b2a3eee9 wokkel/pubsub.py
a b 385 385 """ 386 386 Parse node type out of a request for the default node configuration. 387 387 """ 388 form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG) 389 if form and form.formType == 'submit': 390 values = form.getValues() 391 self.nodeType = values.get('pubsub#node_type', 'leaf') 392 else: 393 self.nodeType = 'leaf' 388 self.nodeType = verbElement.getAttribute('type', u'leaf') 394 389 395 390 396 391 def _parse_configure(self, verbElement): -
wokkel/test/test_pubsub.py
diff -r fc34b2a3eee9 wokkel/test/test_pubsub.py
a b 1688 1688 <iq type='get' to='pubsub.example.org' 1689 1689 from='user@example.org'> 1690 1690 <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> 1691 <default> 1692 <x xmlns='jabber:x:data' type='submit'> 1693 <field var='FORM_TYPE' type='hidden'> 1694 <value>http://jabber.org/protocol/pubsub#node_config</value> 1695 </field> 1696 <field var='pubsub#node_type'> 1697 <value>collection</value> 1698 </field> 1699 </x> 1700 </default> 1701 1691 <default type='collection'/> 1702 1692 </pubsub> 1703 1693 </iq> 1704 1694 """ … … 2668 2658 return fieldDefs 2669 2659 2670 2660 def default(request): 2661 self.assertEquals(u'leaf', request.nodeType) 2671 2662 return defer.succeed({'pubsub#persist_items': 'false', 2672 2663 'x-myfield': '1'}) 2673 2664 … … 2701 2692 <iq type='get' to='pubsub.example.org' 2702 2693 from='user@example.org'> 2703 2694 <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> 2704 <default> 2705 <x xmlns='jabber:x:data' type='submit'> 2706 <field var='FORM_TYPE' type='hidden'> 2707 <value>http://jabber.org/protocol/pubsub#node_config</value> 2708 </field> 2709 <field var='pubsub#node_type'> 2710 <value>unknown</value> 2711 </field> 2712 </x> 2713 </default> 2714 2695 <default type='unknown'/> 2715 2696 </pubsub> 2716 2697 </iq> 2717 2698 """
Note: See TracBrowser
for help on using the repository browser.