Remove trailing whitespaces.

This commit is contained in:
Emmanuel Gil Peyrot 2013-01-18 17:55:34 +01:00
commit 27b3592e16

View file

@ -82,7 +82,7 @@ class GroupBlog():
host.bridge.addMethod("sendGroupBlog", ".plugin", in_sign='sasss', out_sign='',
method=self.sendGroupBlog)
host.bridge.addMethod("getLastGroupBlogs", ".plugin",
in_sign='sis', out_sign='aa{ss}',
method=self.getLastGroupBlogs,
@ -92,21 +92,21 @@ class GroupBlog():
in_sign='sasis', out_sign='a{saa{ss}}',
method=self.getMassiveLastGroupBlogs,
async = True)
host.bridge.addMethod("subscribeGroupBlog", ".plugin", in_sign='ss', out_sign='',
method=self.subscribeGroupBlog,
async = True)
host.bridge.addMethod("massiveSubscribeGroupBlogs", ".plugin", in_sign='sass', out_sign='',
method=self.massiveSubscribeGroupBlogs,
async = True)
host.trigger.add("PubSubItemsReceived", self.pubSubItemsReceivedTrigger)
def getHandler(self, profile):
return GroupBlog_handler()
@defer.inlineCallbacks
def initialise(self, profile_key):
"""Check that this data for this profile are initialised, and do it else
@ -115,14 +115,14 @@ class GroupBlog():
profile = self.host.memory.getProfileName(profile_key)
if not profile:
error(_("Unknown profile"))
raise Exception("Unknown profile")
raise Exception("Unknown profile")
client = self.host.getClient(profile)
if not client:
error(_('No client for this profile key: %s') % profile_key)
raise Exception("Unknown profile")
raise Exception("Unknown profile")
yield client.client_initialized #we want to be sure that the client is initialized
#we first check that we have a item-access pubsub server
if not hasattr(client,"item_access_pubsub"):
debug(_('Looking for item-access power pubsub server'))
@ -136,7 +136,7 @@ class GroupBlog():
info(_("item-access powered pubsub service found: [%s]") % entity.full())
client.item_access_pubsub = entity
client._item_access_pubsub_pending.callback(None)
if hasattr(client,"_item_access_pubsub_pending"):
#XXX: we need to wait for item access pubsub service check
yield client._item_access_pubsub_pending
@ -174,7 +174,7 @@ class GroupBlog():
form_elts = filter(lambda elt: elt.name == "x", item.children)
for form_elt in form_elts:
form = data_form.Form.fromElement(form_elt)
if (form.formNamespace == NS_PUBSUB_ITEM_CONFIG):
access_model = form.get(OPT_ACCESS_MODEL, 'open')
if access_model == "roster":
@ -183,7 +183,7 @@ class GroupBlog():
except KeyError:
warning("No group found for roster access-model")
microblog_data["groups"] = ''
break
def item2gbdata(self, item):
@ -258,12 +258,12 @@ class GroupBlog():
raise NotImplementedError
else:
error(_("Unknown access type"))
raise BadAccessTypeError
raise BadAccessTypeError
self.initialise(profile_key).addCallback(initialised)
def getLastGroupBlogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@'):
"""Get the last published microblogs
@param pub_jid: jid of the publisher
@ -271,7 +271,7 @@ class GroupBlog():
@param profile_key: profile key
@return: list of microblog data (dict)
"""
def initialised(result):
profile, client = result
d = self.host.plugins["XEP-0060"].getItems(client.item_access_pubsub, self.getNodeName(jid.JID(pub_jid)),
@ -292,14 +292,14 @@ class GroupBlog():
"""
def sendResult(result):
"""send result of DeferredList (list of microblogs to the calling method"""
ret = {}
for (success, value) in result:
if success:
source_jid, data = value
ret[source_jid] = data
return ret
def initialised(result):
@ -316,9 +316,9 @@ class GroupBlog():
jids = publishers
else:
raise UnknownType
mblogs = []
for _jid in jids:
d = self.host.plugins["XEP-0060"].getItems(client.item_access_pubsub, self.getNodeName(jid.JID(_jid)),
max_items=max_items, profile_key=profile_key)
@ -326,7 +326,7 @@ class GroupBlog():
mblogs.append(d)
dlist = defer.DeferredList(mblogs)
dlist.addCallback(sendResult)
return dlist
@ -391,7 +391,7 @@ class GroupBlog():
class GroupBlog_handler(XMPPHandler):
implements(iwokkel.IDisco)
def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
return [disco.DiscoFeature(NS_GROUPBLOG)]