Mercurial > libervia-backend
comparison sat_frontends/quick_frontend/quick_profile_manager.py @ 3028:ab2696e34d29
Python 3 port:
/!\ this is a huge commit
/!\ starting from this commit, SàT is needs Python 3.6+
/!\ SàT maybe be instable or some feature may not work anymore, this will improve with time
This patch port backend, bridge and frontends to Python 3.
Roughly this has been done this way:
- 2to3 tools has been applied (with python 3.7)
- all references to python2 have been replaced with python3 (notably shebangs)
- fixed files not handled by 2to3 (notably the shell script)
- several manual fixes
- fixed issues reported by Python 3 that where not handled in Python 2
- replaced "async" with "async_" when needed (it's a reserved word from Python 3.7)
- replaced zope's "implements" with @implementer decorator
- temporary hack to handle data pickled in database, as str or bytes may be returned,
to be checked later
- fixed hash comparison for password
- removed some code which is not needed anymore with Python 3
- deactivated some code which needs to be checked (notably certificate validation)
- tested with jp, fixed reported issues until some basic commands worked
- ported Primitivus (after porting dependencies like urwid satext)
- more manual fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 13 Aug 2019 19:08:41 +0200 |
parents | 003b8b4b56a7 |
children | 9d0df638c8b4 |
comparison
equal
deleted
inserted
replaced
3027:ff5bcb12ae60 | 3028:ab2696e34d29 |
---|---|
120 self.host.launchAction( | 120 self.host.launchAction( |
121 C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, profile=profile | 121 C.AUTHENTICATE_PROFILE_ID, callback=authenticate_cb, profile=profile |
122 ) | 122 ) |
123 | 123 |
124 def getProfileNameEb(failure): | 124 def getProfileNameEb(failure): |
125 log.error(u"Can't retrieve profile name: {}".format(failure)) | 125 log.error("Can't retrieve profile name: {}".format(failure)) |
126 | 126 |
127 for profile_key in profile_keys: | 127 for profile_key in profile_keys: |
128 self.host.bridge.profileNameGet( | 128 self.host.bridge.profileNameGet( |
129 profile_key, callback=getProfileNameCb, errback=getProfileNameEb | 129 profile_key, callback=getProfileNameCb, errback=getProfileNameEb |
130 ) | 130 ) |
131 | 131 |
132 def getParamError(self, __): | 132 def getParamError(self, __): |
133 self.host.showDialog(_(u"Error"), _("Can't get profile parameter"), "error") | 133 self.host.showDialog(_("Error"), _("Can't get profile parameter"), "error") |
134 | 134 |
135 ## Helping methods ## | 135 ## Helping methods ## |
136 | 136 |
137 def _getErrorMessage(self, reason): | 137 def _getErrorMessage(self, reason): |
138 """Return an error message corresponding to profile creation error | 138 """Return an error message corresponding to profile creation error |
213 if login != self.current.login and self.current.login is not None: | 213 if login != self.current.login and self.current.login is not None: |
214 self.current.login = login | 214 self.current.login = login |
215 self.host.bridge.setParam( | 215 self.host.bridge.setParam( |
216 "JabberID", login, "Connection", profile_key=self.current.profile | 216 "JabberID", login, "Connection", profile_key=self.current.profile |
217 ) | 217 ) |
218 log.info(u"login updated for profile [{}]".format(self.current.profile)) | 218 log.info("login updated for profile [{}]".format(self.current.profile)) |
219 if password != self.current.password and self.current.password is not None: | 219 if password != self.current.password and self.current.password is not None: |
220 self.current.password = password | 220 self.current.password = password |
221 self.host.bridge.setParam( | 221 self.host.bridge.setParam( |
222 "Password", password, "Connection", profile_key=self.current.profile | 222 "Password", password, "Connection", profile_key=self.current.profile |
223 ) | 223 ) |
224 log.info( | 224 log.info( |
225 u"password updated for profile [{}]".format(self.current.profile) | 225 "password updated for profile [{}]".format(self.current.profile) |
226 ) | 226 ) |
227 | 227 |
228 ## graphic updates (should probably be overriden in frontends) ## | 228 ## graphic updates (should probably be overriden in frontends) ## |
229 | 229 |
230 def resetFields(self): | 230 def resetFields(self): |