Ignore:
Timestamp:
Jan 5, 2010, 2:55:40 PM (12 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Move findForm to wokkel.data_form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/pubsub.py

    r79 r80  
    253253
    254254
    255     @staticmethod
    256     def _findForm(element, formNamespace):
    257         """
    258         Find a Data Form.
    259 
    260         Look for an element that represents a Data Form with the specified
    261         form namespace as a child element of the given element.
    262         """
    263         if not element:
    264             return None
    265 
    266         form = None
    267         for child in element.elements():
    268             try:
    269                 form = data_form.Form.fromElement(child)
    270             except data_form.Error:
    271                 continue
    272 
    273             if form.formNamespace != NS_PUBSUB_NODE_CONFIG:
    274                 continue
    275 
    276         return form
    277 
    278 
    279255    def _parse_node(self, verbElement):
    280256        """
     
    367343        Parse node type out of a request for the default node configuration.
    368344        """
    369         form = PubSubRequest._findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
     345        form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
    370346        if form and form.formType == 'submit':
    371347            values = form.getValues()
     
    379355        Parse options out of a request for setting the node configuration.
    380356        """
    381         form = PubSubRequest._findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
     357        form = data_form.findForm(verbElement, NS_PUBSUB_NODE_CONFIG)
    382358        if form:
    383359            if form.formType == 'submit':
     
    438414
    439415    def _parse_options(self, verbElement):
    440         form = PubSubRequest._findForm(verbElement, NS_PUBSUB_SUBSCRIBE_OPTIONS)
     416        form = data_form.findForm(verbElement, NS_PUBSUB_SUBSCRIBE_OPTIONS)
    441417        if form:
    442418            if form.formType == 'submit':
Note: See TracChangeset for help on using the changeset viewer.