Mercurial > libervia-backend
comparison src/core/sat_main.py @ 1019:6a16ec17a458
better PEP-8 compliance
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 07 May 2014 15:44:31 +0200 |
parents | fee00f2e11c2 |
children | 8bae81e254a2 |
comparison
equal
deleted
inserted
replaced
1018:e22e4cf86204 | 1019:6a16ec17a458 |
---|---|
203 """Connect to jabber server with asynchronous reply | 203 """Connect to jabber server with asynchronous reply |
204 @param profile_key: %(doc_profile)s | 204 @param profile_key: %(doc_profile)s |
205 """ | 205 """ |
206 profile = self.memory.getProfileName(profile_key) | 206 profile = self.memory.getProfileName(profile_key) |
207 if not profile: | 207 if not profile: |
208 log.error(_('Trying to connect a non-exsitant profile')) | 208 log.error(_('Trying to connect a non-existant profile')) |
209 raise exceptions.ProfileUnknownError(profile_key) | 209 raise exceptions.ProfileUnknownError(profile_key) |
210 | 210 |
211 if self.isConnected(profile): | 211 if self.isConnected(profile): |
212 log.info(_("already connected !")) | 212 log.info(_("already connected !")) |
213 return defer.succeed("None") | 213 return defer.succeed("None") |
217 try: | 217 try: |
218 port = int(self.memory.getParamA("Port", "Connection", profile_key=profile)) | 218 port = int(self.memory.getParamA("Port", "Connection", profile_key=profile)) |
219 except ValueError: | 219 except ValueError: |
220 log.error(_("Can't parse port value, using default value")) | 220 log.error(_("Can't parse port value, using default value")) |
221 port = 5222 | 221 port = 5222 |
222 | |
222 current = self.profiles[profile] = xmpp.SatXMPPClient( | 223 current = self.profiles[profile] = xmpp.SatXMPPClient( |
223 self, profile, | 224 self, profile, |
224 jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile), profile), | 225 jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile), profile), |
225 self.memory.getParamA("Password", "Connection", profile_key=profile), | 226 self.memory.getParamA("Password", "Connection", profile_key=profile), |
226 self.memory.getParamA("Server", "Connection", profile_key=profile), | 227 self.memory.getParamA("Server", "Connection", profile_key=profile), |
276 log.error("error (plugin %(name)s): %(failure)s" % {'name': plugin_conn_cb[idx][0], | 277 log.error("error (plugin %(name)s): %(failure)s" % {'name': plugin_conn_cb[idx][0], |
277 'failure': result}) | 278 'failure': result}) |
278 | 279 |
279 list_d.addCallback(logPluginResults) | 280 list_d.addCallback(logPluginResults) |
280 return list_d | 281 return list_d |
281 | |
282 | 282 |
283 d.addCallback(pluginsConnection) | 283 d.addCallback(pluginsConnection) |
284 return d | 284 return d |
285 | 285 |
286 self.memory.startProfileSession(profile) | 286 self.memory.startProfileSession(profile) |