From 791f3ffb12d18a40da54ca394decd2f029a891ec Mon Sep 17 00:00:00 2001 From: MVA Date: Mon, 27 Feb 2012 15:06:56 +0100 Subject: [PATCH] [FIX] fix the problem of encoding password change special char in hex symbole bzr revid: mva@openerp.com-20120227140656-cttkn1ho2dvrmv21 --- addons/event_moodle/event_moodle.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/event_moodle/event_moodle.py b/addons/event_moodle/event_moodle.py index e3c688fe08c..bcec7484404 100644 --- a/addons/event_moodle/event_moodle.py +++ b/addons/event_moodle/event_moodle.py @@ -46,6 +46,15 @@ class event_moodle(osv.osv): return {'type': 'ir.actions.act_window_close'} #use to quit the wizard + def encode_password(self,cr,uid,ids,password,context=None): + for i in range(len(password)): + x = password[i] + if ord(x)<46: + unicode_car =(hex(ord(x))) + hex_car = '%'+str(unicode_car[2:]) + password = password.replace(x,hex_car) + return password + def make_url(self,cr,uid,ids,context=None): """ create the good url with the information of the configuration @@ -58,7 +67,7 @@ class event_moodle(osv.osv): url="" config_moodle = self.browse(cr, uid, [reg_ids[-1]], context=context) if config_moodle[0].moodle_username and config_moodle[0].moodle_password: - url='http://'+config_moodle[0].serveur_moodle+'/moodle/webservice/xmlrpc/simpleserver.php?wsusername='+config_moodle[0].moodle_username+'&wspassword='+config_moodle[0].moodle_password + url='http://'+config_moodle[0].serveur_moodle+'/moodle/webservice/xmlrpc/simpleserver.php?wsusername='+config_moodle[0].moodle_username+'&wspassword='+self.encode_password(cr,uid,ids,config_moodle[0].moodle_password,context=context) #connexion with password and username #to do warning on special char if config_moodle[0].moodle_token: