core, plugin mblog: fixed some exceptions
This commit is contained in:
parent
ca736144d8
commit
8853328b6f
2 changed files with 7 additions and 4 deletions
|
|
@ -65,7 +65,7 @@ class GroupBlog():
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
info(_("Group blog plugin initialization"))
|
info(_("Group blog plugin initialization"))
|
||||||
self.host = host
|
self.host = host
|
||||||
self._blog_nodes={}
|
self._blog_nodes={} #keep association betweek [profile][node] and [groups]
|
||||||
for i in range(1,21):
|
for i in range(1,21):
|
||||||
self.host.plugins["XEP-0163"].addPEPEvent("MICROBLOG_%02d" % i, NS_MICROBLOG % i, self.groupblogCB, None)
|
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:
|
for item in itemsEvent.items:
|
||||||
microblog_data = self.host.plugins["XEP-0277"]._item2mbdata(item)
|
microblog_data = self.host.plugins["XEP-0277"]._item2mbdata(item)
|
||||||
microblog_data["node"] = itemsEvent.nodeIdentifier
|
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)
|
self.host.bridge.personalEvent(itemsEvent.sender.full(), "MICROBLOG", microblog_data, profile)
|
||||||
|
|
||||||
def _getRootNode(self, entity):
|
def _getRootNode(self, entity):
|
||||||
|
|
@ -316,7 +319,7 @@ class GroupBlog():
|
||||||
|
|
||||||
def cleanBlogCollection(self, profile_key='@DEFAULT@'):
|
def cleanBlogCollection(self, profile_key='@DEFAULT@'):
|
||||||
"""Remove blog nodes not referenced in config node"""
|
"""Remove blog nodes not referenced in config node"""
|
||||||
debug(_('Getting mblog nodes'))
|
debug(_('Cleaning mblog nodes'))
|
||||||
profile = self.host.memory.getProfileName(profile_key)
|
profile = self.host.memory.getProfileName(profile_key)
|
||||||
if not profile:
|
if not profile:
|
||||||
error(_("Unknown profile"))
|
error(_("Unknown profile"))
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import os.path
|
||||||
import time
|
import time
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from logging import debug, info, error
|
from logging import debug, info, warning, error
|
||||||
import pdb
|
import pdb
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.words.protocols.jabber import jid
|
from twisted.words.protocols.jabber import jid
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue