# HG changeset patch # User Goffi # Date 1452032422 -3600 # Node ID 5246a9186b91de7e12ac92d3e04fe979c091c1c6 # Parent 54f834e4034153cdf3ca6bbf2e888318829b9a1b tmp (wokkel.pubsub): PubSubRequest class can be overriden everywhere, including PubSubClient diff -r 54f834e40341 -r 5246a9186b91 wokkel/pubsub.py --- a/wokkel/pubsub.py Tue Jan 05 23:20:20 2016 +0100 +++ b/wokkel/pubsub.py Tue Jan 05 23:20:22 2016 +0100 @@ -759,8 +759,9 @@ """ Publish subscribe client protocol. """ + implements(IPubSubClient) - implements(IPubSubClient) + _request_class = PubSubRequest def connectionInitialized(self): self.xmlstream.addObserver('/message/event[@xmlns="%s"]' % @@ -841,7 +842,7 @@ @param options: Optional node configuration options. @type options: C{dict} """ - request = PubSubRequest('create') + request = self._request_class('create') request.recipient = service request.nodeIdentifier = nodeIdentifier request.sender = sender @@ -874,7 +875,7 @@ @param nodeIdentifier: The identifier of the node. @type nodeIdentifier: C{unicode} """ - request = PubSubRequest('delete') + request = self._request_class('delete') request.recipient = service request.nodeIdentifier = nodeIdentifier request.sender = sender @@ -903,7 +904,7 @@ L{SubscriptionPending} or L{SubscriptionUnconfigured}. @rtype: L{defer.Deferred} """ - request = PubSubRequest('subscribe') + request = self._request_class('subscribe') request.recipient = service request.nodeIdentifier = nodeIdentifier request.subscriber = subscriber @@ -950,7 +951,7 @@ @param subscriptionIdentifier: Optional subscription identifier. @type subscriptionIdentifier: C{unicode} """ - request = PubSubRequest('unsubscribe') + request = self._request_class('unsubscribe') request.recipient = service request.nodeIdentifier = nodeIdentifier request.subscriber = subscriber @@ -970,7 +971,7 @@ @param items: Optional list of L{Item}s to publish. @type items: C{list} """ - request = PubSubRequest('publish') + request = self._request_class('publish') request.recipient = service request.nodeIdentifier = nodeIdentifier request.items = items @@ -1000,7 +1001,7 @@ the results to the specific subscription. @type subscriptionIdentifier: C{unicode} """ - request = PubSubRequest('items') + request = self._request_class('items') request.recipient = service request.nodeIdentifier = nodeIdentifier if maxItems: @@ -1033,7 +1034,7 @@ @param notify: True if notification is required @type notify: C{unicode} """ - request = PubSubRequest('retract') + request = self._request_class('retract') request.recipient = service request.nodeIdentifier = nodeIdentifier request.itemIdentifiers = itemIdentifiers @@ -1060,7 +1061,7 @@ @rtype: L{data_form.Form} """ - request = PubSubRequest('optionsGet') + request = self._request_class('optionsGet') request.recipient = service request.nodeIdentifier = nodeIdentifier request.subscriber = subscriber @@ -1098,7 +1099,7 @@ @param subscriptionIdentifier: Optional subscription identifier. @type subscriptionIdentifier: C{unicode} """ - request = PubSubRequest('optionsSet') + request = self._request_class('optionsSet') request.recipient = service request.nodeIdentifier = nodeIdentifier request.subscriber = subscriber @@ -1218,7 +1219,7 @@ info = [] - request = PubSubRequest('discoInfo') + request = self._request_class('discoInfo') if self.resource is not None: resource = self.resource.locateResource(request) @@ -1250,7 +1251,7 @@ if self.hideNodes: d = defer.succeed([]) elif self.resource is not None: - request = PubSubRequest('discoInfo') + request = self._request_class('discoInfo') resource = self.resource.locateResource(request) d = resource.getNodes(requestor, target, nodeIdentifier) elif nodeIdentifier: