From 08be795ef0d1ee97e475bff71a5a9a3febd736fe Mon Sep 17 00:00:00 2001 From: MVA Date: Mon, 27 Feb 2012 17:03:21 +0100 Subject: [PATCH] [FIX] change the if test in _encode_password and fix a call of encode_password bzr revid: mva@openerp.com-20120227160321-q1knzzsly00u9lsz --- addons/event_moodle/event_moodle.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/event_moodle/event_moodle.py b/addons/event_moodle/event_moodle.py index 7f4234c6cbf..2f1928d87a5 100644 --- a/addons/event_moodle/event_moodle.py +++ b/addons/event_moodle/event_moodle.py @@ -67,8 +67,8 @@ class event_moodle(osv.osv): def _encode_password(password): for i in range(len(password)): x = password[i] - if (ord(x)<48 or ord(x)>57)and(ord(x)<64 or ord(x)>90)and(ord(x)<96 or ord(x)>122): - unicode_car =(hex(ord(x))) + if x not in string.ascii_letters + string.digits: + unicode_car = (hex(ord(x))) hex_car = '%'+str(unicode_car[2:]) password = password.replace(x,hex_car) return password @@ -76,7 +76,7 @@ class event_moodle(osv.osv): config_moodle = self.browse(cr, uid, ids[0], context=context) if config_moodle.moodle_username and config_moodle.moodle_password: #connexion with password and username - password = self._encode_password(config_moodle.moodle_password) + password = _encode_password(config_moodle.moodle_password) url = config_moodle.server_moodle + '/moodle/webservice/xmlrpc/simpleserver.php?wsusername=' + config_moodle.moodle_username + '&wspassword=' + password if config_moodle.moodle_token: #connexion with token @@ -128,6 +128,7 @@ class event_moodle(osv.osv): return passwd def check_email(self,email): + """ check if email is correct """