diff --git a/frontends/src/primitivus/primitivus b/frontends/src/primitivus/primitivus index 33217c31..1d23a29b 100755 --- a/frontends/src/primitivus/primitivus +++ b/frontends/src/primitivus/primitivus @@ -446,15 +446,17 @@ class PrimitivusApp(QuickApp, InputHistory): """ if data is None: data = dict() + def action_cb(data): if not data: # action was a one shot, nothing to do pass elif "xmlui" in data: - ui = XMLUI(self, xml_data = data['xmlui']) + ui = XMLUI(self, xml_data=data['xmlui']) ui.show() else: self.showPopUp(sat_widgets.Alert(_("Error"), _(u"Unmanaged action result"), ok_cb=self.removePopUp)) + def action_eb(failure): self.showPopUp(sat_widgets.Alert(_("Error"), unicode(failure), ok_cb=self.removePopUp)) diff --git a/frontends/src/primitivus/profile_manager.py b/frontends/src/primitivus/profile_manager.py index 45990f1b..caea6458 100644 --- a/frontends/src/primitivus/profile_manager.py +++ b/frontends/src/primitivus/profile_manager.py @@ -19,7 +19,7 @@ from sat.core.i18n import _ import urwid -from urwid_satext.sat_widgets import AdvancedEdit,Password,List,InputDialog,ConfirmDialog,Alert +from urwid_satext.sat_widgets import AdvancedEdit, Password, List, InputDialog, ConfirmDialog, Alert from sat.tools.jid import JID @@ -32,8 +32,8 @@ class ProfileManager(urwid.WidgetWrap): profiles.sort() #login & password box must be created before list because of onProfileChange - self.login_wid = AdvancedEdit(_('Login:'),align='center') - self.pass_wid = Password(_('Password:'),align='center') + self.login_wid = AdvancedEdit(_('Login:'), align='center') + self.pass_wid = Password(_('Password:'), align='center') self.list_profile = List(profiles, style=['single'], align='center', on_change=self.onProfileChange) @@ -107,6 +107,7 @@ class ProfileManager(urwid.WidgetWrap): def setJID(jabberID): self.login_wid.set_edit_text(jabberID) self.host.redraw() + def setPassword(password): self.pass_wid.set_edit_text(password) self.host.redraw() diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py index 8c6254bf..a25a1781 100644 --- a/frontends/src/quick_frontend/quick_app.py +++ b/frontends/src/quick_frontend/quick_app.py @@ -27,7 +27,7 @@ from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate from optparse import OptionParser -from sat_frontends.quick_frontend.constants import Const +from sat_frontends.quick_frontend.constants import Const as C class QuickApp(object): @@ -281,7 +281,7 @@ class QuickApp(object): self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '') def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key="@NONE@"): - if to_jid.startswith(Const.PRIVATE_PREFIX): + if to_jid.startswith(C.PRIVATE_PREFIX): to_jid = unescapePrivate(to_jid) mess_type = "chat" if callback is None: @@ -527,7 +527,7 @@ class QuickApp(object): if from_jid_s == '@ALL@': target = '@ALL@' - nick = Const.ALL_OCCUPANTS + nick = C.ALL_OCCUPANTS else: from_jid = JID(from_jid_s) target = from_jid.bare diff --git a/src/bridge/bridge_constructor/bridge_template.ini b/src/bridge/bridge_constructor/bridge_template.ini index a68aabdc..f47471b6 100644 --- a/src/bridge/bridge_constructor/bridge_template.ini +++ b/src/bridge/bridge_constructor/bridge_template.ini @@ -218,7 +218,6 @@ errback is called with error constant as parameter: - ProfileUnknownError: the profile name is unknown - ConnectedProfileError: a connected profile would not be deleted - [registerNewAccount] deprecated= type=method diff --git a/src/core/exceptions.py b/src/core/exceptions.py index e1a96596..ba1d57ca 100644 --- a/src/core/exceptions.py +++ b/src/core/exceptions.py @@ -85,5 +85,6 @@ class BridgeInitError(Exception): class BridgeExceptionNoService(Exception): pass + class DatabaseError(Exception): pass diff --git a/src/core/sat_main.py b/src/core/sat_main.py index 481203c9..1413219e 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -205,7 +205,7 @@ class SAT(service.Service): """ profile = self.memory.getProfileName(profile_key) if not profile: - log.error(_('Trying to connect a non-exsitant profile')) + log.error(_('Trying to connect a non-existant profile')) raise exceptions.ProfileUnknownError(profile_key) if self.isConnected(profile): @@ -219,6 +219,7 @@ class SAT(service.Service): except ValueError: log.error(_("Can't parse port value, using default value")) port = 5222 + current = self.profiles[profile] = xmpp.SatXMPPClient( self, profile, jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile), profile), @@ -279,7 +280,6 @@ class SAT(service.Service): list_d.addCallback(logPluginResults) return list_d - d.addCallback(pluginsConnection) return d diff --git a/src/memory/params.py b/src/memory/params.py index 3f2cfdca..b2903e0b 100644 --- a/src/memory/params.py +++ b/src/memory/params.py @@ -598,11 +598,11 @@ class Params(object): """Return a node from the param_xml @param name: name of the node @param category: category of the node - @type_: keyword for search: + @param type_: keyword for search: @ALL@ search everywhere @GENERAL@ only search in general type @INDIVIDUAL@ only search in individual type - @return: a tuple with the node type and the the node, or None if not found""" + @return: a tuple (node type, node) or None if not found""" for type_node in self.dom.documentElement.childNodes: if (((type_ == "@ALL@" or type_ == "@GENERAL@") and type_node.nodeName == C.GENERAL) diff --git a/src/memory/sqlite.py b/src/memory/sqlite.py index 8c7773a4..c00d47cc 100644 --- a/src/memory/sqlite.py +++ b/src/memory/sqlite.py @@ -127,7 +127,6 @@ class SqliteStorage(object): for statement in statements: interaction.execute(statement) - #Profiles def _profilesCache(self, profiles_result): """Fill the profiles cache @@ -544,7 +543,7 @@ class Updater(object): # Database is not up-to-date, we'll do the update log.info(_("Database schema has changed, local database will be updated")) update_raw = [] - for version in xrange(local_version+1, CURRENT_DB_VERSION+1): + for version in xrange(local_version + 1, CURRENT_DB_VERSION + 1): try: update_data = DATABASE_SCHEMAS[version] except KeyError: