quick_frontend(blog): groups blog sending is handled

This commit is contained in:
Goffi 2015-11-24 16:21:18 +01:00
commit da0c8ec0ba

View file

@ -25,6 +25,7 @@ log = getLogger(__name__)
from sat_frontends.quick_frontend.constants import Const as C from sat_frontends.quick_frontend.constants import Const as C
from sat_frontends.quick_frontend import quick_widgets from sat_frontends.quick_frontend import quick_widgets
from sat_frontends.tools import jid from sat_frontends.tools import jid
from sat.tools import common
try: try:
# FIXME: to be removed when an acceptable solution is here # FIXME: to be removed when an acceptable solution is here
@ -262,12 +263,15 @@ class Entry(EntriesManager):
mb_data.update(tags2mbdata(self.item.tags)) mb_data.update(tags2mbdata(self.item.tags))
if self.blog.new_message_target not in (C.PUBLIC, C.GROUP):
raise NotImplementedError
if self.level == 0: if self.level == 0:
if self.blog.new_message_target == C.PUBLIC: if self.new:
if self.new: mb_data["allow_comments"] = C.BOOL_TRUE
mb_data["allow_comments"] = C.BOOL_TRUE
else: if self.blog.new_message_target == C.GROUP:
raise NotImplementedError common.iter2dict('group', self.blog.targets, mb_data)
self.blog.host.bridge.mbSend( self.blog.host.bridge.mbSend(
unicode(self.service or ''), unicode(self.service or ''),
@ -339,7 +343,7 @@ class QuickBlog(EntriesManager, quick_widgets.QuickWidget):
if self._targets_type == C.ALL: if self._targets_type == C.ALL:
return C.PUBLIC return C.PUBLIC
elif self._targets_type == C.GROUP: elif self._targets_type == C.GROUP:
return self.targets return C.GROUP
else: else:
raise ValueError("Unkown targets type") raise ValueError("Unkown targets type")