[FIX] change the if test in _encode_password and fix a call of encode_password
bzr revid: mva@openerp.com-20120227160321-q1knzzsly00u9lsz
This commit is contained in:
parent
a914c6cba2
commit
08be795ef0
|
@ -67,8 +67,8 @@ class event_moodle(osv.osv):
|
||||||
def _encode_password(password):
|
def _encode_password(password):
|
||||||
for i in range(len(password)):
|
for i in range(len(password)):
|
||||||
x = password[i]
|
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):
|
if x not in string.ascii_letters + string.digits:
|
||||||
unicode_car =(hex(ord(x)))
|
unicode_car = (hex(ord(x)))
|
||||||
hex_car = '%'+str(unicode_car[2:])
|
hex_car = '%'+str(unicode_car[2:])
|
||||||
password = password.replace(x,hex_car)
|
password = password.replace(x,hex_car)
|
||||||
return password
|
return password
|
||||||
|
@ -76,7 +76,7 @@ class event_moodle(osv.osv):
|
||||||
config_moodle = self.browse(cr, uid, ids[0], context=context)
|
config_moodle = self.browse(cr, uid, ids[0], context=context)
|
||||||
if config_moodle.moodle_username and config_moodle.moodle_password:
|
if config_moodle.moodle_username and config_moodle.moodle_password:
|
||||||
#connexion with password and username
|
#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
|
url = config_moodle.server_moodle + '/moodle/webservice/xmlrpc/simpleserver.php?wsusername=' + config_moodle.moodle_username + '&wspassword=' + password
|
||||||
if config_moodle.moodle_token:
|
if config_moodle.moodle_token:
|
||||||
#connexion with token
|
#connexion with token
|
||||||
|
@ -128,6 +128,7 @@ class event_moodle(osv.osv):
|
||||||
return passwd
|
return passwd
|
||||||
|
|
||||||
def check_email(self,email):
|
def check_email(self,email):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
check if email is correct
|
check if email is correct
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue