core, plugin mblog: fixed some exceptions

This commit is contained in:
Goffi 2011-05-17 01:34:17 +02:00
commit 8853328b6f
2 changed files with 7 additions and 4 deletions

View file

@ -65,7 +65,7 @@ class GroupBlog():
def __init__(self, host):
info(_("Group blog plugin initialization"))
self.host = host
self._blog_nodes={}
self._blog_nodes={} #keep association betweek [profile][node] and [groups]
for i in range(1,21):
self.host.plugins["XEP-0163"].addPEPEvent("MICROBLOG_%02d" % i, NS_MICROBLOG % i, self.groupblogCB, None)
@ -101,7 +101,10 @@ class GroupBlog():
for item in itemsEvent.items:
microblog_data = self.host.plugins["XEP-0277"]._item2mbdata(item)
microblog_data["node"] = itemsEvent.nodeIdentifier
microblog_data["groups"] = "\n".join(self._blog_nodes[profile].get(itemsEvent.nodeIdentifier, []))
try:
microblog_data["groups"] = "\n".join(self._blog_nodes[profile].get(itemsEvent.nodeIdentifier, []))
except KeyError:
pass
self.host.bridge.personalEvent(itemsEvent.sender.full(), "MICROBLOG", microblog_data, profile)
def _getRootNode(self, entity):
@ -316,7 +319,7 @@ class GroupBlog():
def cleanBlogCollection(self, profile_key='@DEFAULT@'):
"""Remove blog nodes not referenced in config node"""
debug(_('Getting mblog nodes'))
debug(_('Cleaning mblog nodes'))
profile = self.host.memory.getProfileName(profile_key)
if not profile:
error(_("Unknown profile"))