comparison src/browser/libervia_main.py @ 694:82123705474b

massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 14:57:02 +0200
parents 7a9c7b9f6a28
children c2f22ca12e23
comparison
equal deleted inserted replaced
693:1d60fa4d25a4 694:82123705474b
256 return C.DEFAULT_AVATAR_URL 256 return C.DEFAULT_AVATAR_URL
257 ret = os.path.join(C.AVATARS_DIR, avatar_hash) 257 ret = os.path.join(C.AVATARS_DIR, avatar_hash)
258 return ret 258 return ret
259 259
260 def registerWidget(self, wid): 260 def registerWidget(self, wid):
261 log.debug("Registering %s" % wid.getDebugName()) 261 log.debug(u"Registering %s" % wid.getDebugName())
262 self.libervia_widgets.add(wid) 262 self.libervia_widgets.add(wid)
263 263
264 def unregisterWidget(self, wid): 264 def unregisterWidget(self, wid):
265 try: 265 try:
266 self.libervia_widgets.remove(wid) 266 self.libervia_widgets.remove(wid)
267 except KeyError: 267 except KeyError:
268 log.warning('trying to remove a non registered Widget: %s' % wid.getDebugName()) 268 log.warning(u'trying to remove a non registered Widget: %s' % wid.getDebugName())
269 269
270 def refresh(self): 270 def refresh(self):
271 """Refresh the general display.""" 271 """Refresh the general display."""
272 self.panel.refresh() 272 self.panel.refresh()
273 for lib_wid in self.libervia_widgets: 273 for lib_wid in self.libervia_widgets:
367 # #We want to know our own jid 367 # #We want to know our own jid
368 # self.bridge.call('getProfileJid', self._getProfileJidCB) 368 # self.bridge.call('getProfileJid', self._getProfileJidCB)
369 369
370 def domain_cb(value): 370 def domain_cb(value):
371 self._defaultDomain = value 371 self._defaultDomain = value
372 log.info("new account domain: %s" % value) 372 log.info(u"new account domain: %s" % value)
373 373
374 def domain_eb(value): 374 def domain_eb(value):
375 self._defaultDomain = "libervia.org" 375 self._defaultDomain = "libervia.org"
376 376
377 self.bridge.getNewAccountDomain(callback=domain_cb, errback=domain_eb) 377 self.bridge.getNewAccountDomain(callback=domain_cb, errback=domain_eb)
416 self.resize() 416 self.resize()
417 417
418 return contact_list 418 return contact_list
419 419
420 def newWidget(self, wid): 420 def newWidget(self, wid):
421 log.debug("newWidget: {}".format(wid)) 421 log.debug(u"newWidget: {}".format(wid))
422 self.addWidget(wid) 422 self.addWidget(wid)
423 423
424 def newMessageHandler(self, from_jid_s, msg, type_, to_jid_s, extra, profile=C.PROF_KEY_NONE): 424 def newMessageHandler(self, from_jid_s, msg, type_, to_jid_s, extra, profile=C.PROF_KEY_NONE):
425 if type_ == C.MESS_TYPE_HEADLINE: 425 if type_ == C.MESS_TYPE_HEADLINE:
426 from_jid = jid.JID(from_jid_s) 426 from_jid = jid.JID(from_jid_s)
513 """ 513 """
514 cache = [] 514 cache = []
515 for publisher in mblogs: 515 for publisher in mblogs:
516 for mblog in mblogs[publisher][0]: 516 for mblog in mblogs[publisher][0]:
517 if 'content' not in mblog: 517 if 'content' not in mblog:
518 log.warning("No content found in microblog [%s]" % mblog) 518 log.warning(u"No content found in microblog [%s]" % mblog)
519 continue 519 continue
520 if 'groups' in mblog: 520 if 'groups' in mblog:
521 _groups = set(mblog['groups'].split() if mblog['groups'] else []) 521 _groups = set(mblog['groups'].split() if mblog['groups'] else [])
522 else: 522 else:
523 _groups = None 523 _groups = None
624 if len(self.mblog_cache) > MAX_MBLOG_CACHE: 624 if len(self.mblog_cache) > MAX_MBLOG_CACHE:
625 del self.mblog_cache[0:len(self.mblog_cache - MAX_MBLOG_CACHE)] 625 del self.mblog_cache[0:len(self.mblog_cache - MAX_MBLOG_CACHE)]
626 elif event_type == 'MICROBLOG_DELETE': 626 elif event_type == 'MICROBLOG_DELETE':
627 for wid in self.widgets.getWidgets(blog.MicroblogPanel): 627 for wid in self.widgets.getWidgets(blog.MicroblogPanel):
628 wid.removeEntry(data['type'], data['id']) 628 wid.removeEntry(data['type'], data['id'])
629 log.debug("%s %s %s" % (self.whoami.bare, sender, data['type']))
630 629
631 if sender == self.whoami.bare and data['type'] == 'main_item': 630 if sender == self.whoami.bare and data['type'] == 'main_item':
632 for index in xrange(0, len(self.mblog_cache)): 631 for index in xrange(0, len(self.mblog_cache)):
633 entry = self.mblog_cache[index] 632 entry = self.mblog_cache[index]
634 if entry[1].id == data['id']: 633 if entry[1].id == data['id']:
644 for cache_entry in mblogs: 643 for cache_entry in mblogs:
645 _groups, mblog_entry = cache_entry 644 _groups, mblog_entry = cache_entry
646 mblog_panel.addEntryIfAccepted(self.whoami.bare, *cache_entry) 645 mblog_panel.addEntryIfAccepted(self.whoami.bare, *cache_entry)
647 646
648 def getEntityMBlog(self, entity): 647 def getEntityMBlog(self, entity):
649 log.info("geting mblog for entity [%s]" % (entity,)) 648 log.info(u"geting mblog for entity [%s]" % (entity,))
650 for lib_wid in self.libervia_widgets: 649 for lib_wid in self.libervia_widgets:
651 if isinstance(lib_wid, blog.MicroblogPanel): 650 if isinstance(lib_wid, blog.MicroblogPanel):
652 if lib_wid.isJidAccepted(entity): 651 if lib_wid.isJidAccepted(entity):
653 self.bridge.call('getMassiveMblogs', lib_wid.massiveInsert, 'JID', [unicode(entity)]) 652 self.bridge.call('getMassiveMblogs', lib_wid.massiveInsert, 'JID', [unicode(entity)])
654 653