Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_blog.py @ 1650:b08b828a87c9
quick frontend (blog): fixed group blog panels (displaying only, sending is not working yet)
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 23 Nov 2015 16:21:32 +0100 |
parents | 9e17690fb187 |
children | 47224056ce5c |
comparison
equal
deleted
inserted
replaced
1649:b58c8b4715c6 | 1650:b08b828a87c9 |
---|---|
373 def getAll(self): | 373 def getAll(self): |
374 """Get all (micro)blogs from self.targets""" | 374 """Get all (micro)blogs from self.targets""" |
375 def gotSession(rt_session): | 375 def gotSession(rt_session): |
376 self._getResults(rt_session) | 376 self._getResults(rt_session) |
377 | 377 |
378 if self._targets_type == C.ALL: | 378 if self._targets_type in (C.ALL, C.GROUP): |
379 self.host.bridge.mbGetFromManyWithComments(C.ALL, (), 10, 10, {}, {"subscribe":C.BOOL_TRUE}, profile=self.profile, callback=gotSession) | 379 targets = tuple(self.targets) if self._targets_type is C.GROUP else () |
380 self.host.bridge.mbGetFromManyWithComments(self._targets_type, targets, 10, 10, {}, {"subscribe":C.BOOL_TRUE}, profile=self.profile, callback=gotSession) | |
380 own_pep = self.host.whoami.bare | 381 own_pep = self.host.whoami.bare |
381 self.host.bridge.mbGetFromManyWithComments(C.JID, (unicode(own_pep),), 10, 10, {}, {}, profile=self.profile, callback=gotSession) | 382 self.host.bridge.mbGetFromManyWithComments(C.JID, (unicode(own_pep),), 10, 10, {}, {}, profile=self.profile, callback=gotSession) |
383 else: | |
384 raise NotImplementedError(u'{} target type is not managed'.format(self._targets_type)) | |
382 | 385 |
383 def isJidAccepted(self, jid_): | 386 def isJidAccepted(self, jid_): |
384 """Tell if a jid is actepted and must be shown in this panel | 387 """Tell if a jid is actepted and must be shown in this panel |
385 | 388 |
386 @param jid_(jid.JID): jid to check | 389 @param jid_(jid.JID): jid to check |
456 COMMENTS_CLS = ENTRY_CLS | 459 COMMENTS_CLS = ENTRY_CLS |
457 | 460 |
458 | 461 |
459 def mbdata2tags(mb_data): | 462 def mbdata2tags(mb_data): |
460 """Parse the tags in microblog data. | 463 """Parse the tags in microblog data. |
461 | 464 |
462 @param mb_data (dict): microblog data as return by bridge methods | 465 @param mb_data (dict): microblog data as return by bridge methods |
463 @return list[unicode] | 466 @return list[unicode] |
464 """ | 467 """ |
465 return [tag for key, tag in mb_data.iteritems() if (key == "tag" or key.startswith("tag#")) and tag] | 468 return [tag for key, tag in mb_data.iteritems() if (key == "tag" or key.startswith("tag#")) and tag] |
466 | 469 |
467 def tags2mbdata(tags): | 470 def tags2mbdata(tags): |
468 """Build from the tags a dict using the microblog data format. | 471 """Build from the tags a dict using the microblog data format. |
469 | 472 |
470 @param tags (list[unicode]): list of tags | 473 @param tags (list[unicode]): list of tags |
471 @return dict | 474 @return dict |
472 """ | 475 """ |
473 data = {} | 476 data = {} |
474 count = 0 | 477 count = 0 |