Fix pep8 support in src/plugins.

This commit is contained in:
Emmanuel Gil Peyrot 2013-01-18 17:55:35 +01:00
commit 0dca274360

View file

@ -30,23 +30,24 @@ from wokkel import disco, iwokkel, pubsub
from zope.interface import implements
PLUGIN_INFO = {
"name": "Publish-Subscribe",
"import_name": "XEP-0060",
"type": "XEP",
"protocols": ["XEP-0060"],
"dependencies": [],
"main": "XEP_0060",
"handler": "yes",
"description": _("""Implementation of PubSub Protocol""")
"name": "Publish-Subscribe",
"import_name": "XEP-0060",
"type": "XEP",
"protocols": ["XEP-0060"],
"dependencies": [],
"main": "XEP_0060",
"handler": "yes",
"description": _("""Implementation of PubSub Protocol""")
}
class XEP_0060(object):
def __init__(self, host):
info(_("PubSub plugin initialization"))
self.host = host
self.managedNodes=[]
self.clients={}
self.managedNodes = []
self.clients = {}
"""host.bridge.addMethod("getItems", ".plugin", in_sign='ssa{ss}s', out_sign='as', method=self.getItems,
async = True,
doc = { 'summary':'retrieve items',
@ -78,8 +79,8 @@ class XEP_0060(object):
profile = self.host.memory.getProfileName(profile_key)
if not profile:
err_mess = _('Trying to %(action)s with an unknown profile key [%(profile_key)s]') % {
'action':action,
'profile_key':profile_key}
'action': action,
'profile_key': profile_key}
error(err_mess)
raise Exception(err_mess)
try:
@ -91,31 +92,31 @@ class XEP_0060(object):
return profile, client
def publish(self, service, nodeIdentifier, items=None, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'publish item')
profile, client = self.__getClientNProfile(profile_key, 'publish item')
return client.publish(service, nodeIdentifier, items, client.parent.jid)
def getItems(self, service, node, max_items=None, sub_id=None, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'get items')
profile, client = self.__getClientNProfile(profile_key, 'get items')
return client.items(service, node, max_items, sub_id, client.parent.jid)
def getOptions(self, service, nodeIdentifier, subscriber, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'get options')
profile, client = self.__getClientNProfile(profile_key, 'get options')
return client.getOptions(service, nodeIdentifier, subscriber, subscriptionIdentifier)
def setOptions(self, service, nodeIdentifier, subscriber, options, subscriptionIdentifier=None, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'set options')
profile, client = self.__getClientNProfile(profile_key, 'set options')
return client.setOptions(service, nodeIdentifier, subscriber, options, subscriptionIdentifier)
def createNode(self, service, nodeIdentifier, options, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'create node')
profile, client = self.__getClientNProfile(profile_key, 'create node')
return client.createNode(service, nodeIdentifier, options)
def deleteNode(self, service, nodeIdentifier, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'delete node')
profile, client = self.__getClientNProfile(profile_key, 'delete node')
return client.deleteNode(service, nodeIdentifier)
def subscribe(self, service, nodeIdentifier, sub_jid = None, options=None, profile_key='@DEFAULT@'):
profile,client = self.__getClientNProfile(profile_key, 'subscribe node')
def subscribe(self, service, nodeIdentifier, sub_jid=None, options=None, profile_key='@DEFAULT@'):
profile, client = self.__getClientNProfile(profile_key, 'subscribe node')
return client.subscribe(service, nodeIdentifier, sub_jid or client.parent.jid.userhostJID(), options=options)
@ -123,7 +124,7 @@ class SatPubSubClient(pubsub.PubSubClient):
implements(disco.IDisco)
def __init__(self, host, parent_plugin):
self.host=host
self.host = host
self.parent_plugin = parent_plugin
pubsub.PubSubClient.__init__(self)
@ -152,4 +153,3 @@ class SatPubSubClient(pubsub.PubSubClient):
def getDiscoItems(self, requestor, target, nodeIdentifier=''):
return []