Mercurial > libervia-backend
comparison frontends/src/jp/base.py @ 1588:823a385235ef
jp: fixed bad --connect option check
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 14 Nov 2015 19:18:10 +0100 |
parents | 3d5193b4c582 |
children | 313f2bb7841b |
comparison
equal
deleted
inserted
replaced
1587:698d6755d62a | 1588:823a385235ef |
---|---|
219 pass | 219 pass |
220 | 220 |
221 return dest_jids | 221 return dest_jids |
222 | 222 |
223 def connect_profile(self, callback): | 223 def connect_profile(self, callback): |
224 """ Check if the profile is connected | 224 """ Check if the profile is connected and do it if requested |
225 | 225 |
226 @param callback: method to call when profile is connected | 226 @param callback: method to call when profile is connected |
227 @exit: - 1 when profile is not connected and --connect is not set | 227 @exit: - 1 when profile is not connected and --connect is not set |
228 - 1 when the profile doesn't exists | 228 - 1 when the profile doesn't exists |
229 - 1 when there is a connection error | 229 - 1 when there is a connection error |
239 if not self.profile: | 239 if not self.profile: |
240 error(_("The profile [%s] doesn't exist") % self.args.profile) | 240 error(_("The profile [%s] doesn't exist") % self.args.profile) |
241 self.quit(1) | 241 self.quit(1) |
242 | 242 |
243 if not hasattr(self.args, 'connect'): | 243 if not hasattr(self.args, 'connect'): |
244 # a profile can be presente without connect option (e.g. on profile creation/deletion) | 244 # a profile can be present without connect option (e.g. on profile creation/deletion) |
245 return | 245 return |
246 elif self.args.connect is not None: # if connection is asked, we connect the profile | 246 elif self.args.connect is True: # if connection is asked, we connect the profile |
247 self.bridge.asyncConnect(self.profile, self.args.pwd, lambda dummy: callback(), cant_connect) | 247 self.bridge.asyncConnect(self.profile, self.args.pwd, lambda dummy: callback(), cant_connect) |
248 self._auto_loop = True | 248 self._auto_loop = True |
249 return | 249 return |
250 elif not self.bridge.isConnected(self.profile): | 250 elif not self.bridge.isConnected(self.profile): |
251 error(_(u"Profile [%(profile)s] is not connected, please connect it before using jp, or use --connect option") % { "profile": self.profile }) | 251 error(_(u"Profile [%(profile)s] is not connected, please connect it before using jp, or use --connect option") % { "profile": self.profile }) |