Mercurial > libervia-backend
changeset 1019:6a16ec17a458
better PEP-8 compliance
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 07 May 2014 15:44:31 +0200 |
parents | e22e4cf86204 |
children | adbde4a3a52f |
files | frontends/src/primitivus/primitivus frontends/src/primitivus/profile_manager.py frontends/src/quick_frontend/quick_app.py src/bridge/bridge_constructor/bridge_template.ini src/core/exceptions.py src/core/sat_main.py src/memory/params.py src/memory/sqlite.py |
diffstat | 8 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus Thu May 08 19:11:47 2014 +0200 +++ b/frontends/src/primitivus/primitivus Wed May 07 15:44:31 2014 +0200 @@ -446,15 +446,17 @@ """ 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))
--- a/frontends/src/primitivus/profile_manager.py Thu May 08 19:11:47 2014 +0200 +++ b/frontends/src/primitivus/profile_manager.py Wed May 07 15:44:31 2014 +0200 @@ -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 @@ 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 @@ 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()
--- a/frontends/src/quick_frontend/quick_app.py Thu May 08 19:11:47 2014 +0200 +++ b/frontends/src/quick_frontend/quick_app.py Wed May 07 15:44:31 2014 +0200 @@ -27,7 +27,7 @@ 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 @@ 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 @@ 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
--- a/src/bridge/bridge_constructor/bridge_template.ini Thu May 08 19:11:47 2014 +0200 +++ b/src/bridge/bridge_constructor/bridge_template.ini Wed May 07 15:44:31 2014 +0200 @@ -218,7 +218,6 @@ - ProfileUnknownError: the profile name is unknown - ConnectedProfileError: a connected profile would not be deleted - [registerNewAccount] deprecated= type=method
--- a/src/core/exceptions.py Thu May 08 19:11:47 2014 +0200 +++ b/src/core/exceptions.py Wed May 07 15:44:31 2014 +0200 @@ -85,5 +85,6 @@ class BridgeExceptionNoService(Exception): pass + class DatabaseError(Exception): pass
--- a/src/core/sat_main.py Thu May 08 19:11:47 2014 +0200 +++ b/src/core/sat_main.py Wed May 07 15:44:31 2014 +0200 @@ -205,7 +205,7 @@ """ 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 @@ 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 @@ list_d.addCallback(logPluginResults) return list_d - d.addCallback(pluginsConnection) return d
--- a/src/memory/params.py Thu May 08 19:11:47 2014 +0200 +++ b/src/memory/params.py Wed May 07 15:44:31 2014 +0200 @@ -598,11 +598,11 @@ """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)
--- a/src/memory/sqlite.py Thu May 08 19:11:47 2014 +0200 +++ b/src/memory/sqlite.py Wed May 07 15:44:31 2014 +0200 @@ -127,7 +127,6 @@ for statement in statements: interaction.execute(statement) - #Profiles def _profilesCache(self, profiles_result): """Fill the profiles cache @@ -544,7 +543,7 @@ # 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: