Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_chat.py @ 736:6246eb6d64a0
frontends: define the constants with classes and inheritance instance of using __builtin__
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 23 Nov 2013 10:21:40 +0100 |
parents | f7878ad3c846 |
children | bfabeedbf32e |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py Sun Nov 24 11:22:20 2013 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Sat Nov 23 10:21:40 2013 +0100 @@ -20,6 +20,7 @@ from logging import debug, info, warning, error from sat.tools.jid import JID from sat_frontends.quick_frontend.quick_utils import unescapePrivate +from sat_frontends.quick_frontend.constants import Const class QuickChat(object): @@ -107,7 +108,7 @@ def onHistoryError(err): error (_("Can't get history")) - if self.target.startswith(const_PRIVATE_PREFIX): + if self.target.startswith(Const.PRIVATE_PREFIX): target = unescapePrivate(self.target) else: target = self.target.bare @@ -116,9 +117,9 @@ def _get_nick(self, jid): """Return nick of this jid when possible""" - if self.target.startswith(const_PRIVATE_PREFIX): + if self.target.startswith(Const.PRIVATE_PREFIX): unescaped = unescapePrivate(self.target) - if jid.startswith(const_PRIVATE_PREFIX) or unescaped.bare == jid.bare: + if jid.startswith(Const.PRIVATE_PREFIX) or unescaped.bare == jid.bare: return unescaped.resource return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node)