Mercurial > libervia-backend
diff src/plugins/plugin_misc_groupblog.py @ 326:0f9925193586
core, plugin mblog: fixed some exceptions
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 17 May 2011 01:34:17 +0200 |
parents | f56108eb2880 |
children | 2572351d875a |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_groupblog.py Wed May 11 19:49:55 2011 +0200 +++ b/src/plugins/plugin_misc_groupblog.py Tue May 17 01:34:17 2011 +0200 @@ -65,7 +65,7 @@ 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 @@ 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 @@ 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"))