Ajay Chauhan(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-opw-578969-port-cha into lp:openobject-addons.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-578969-port-cha/+merge/138964 Hello, To reproduce this issue, try to send invitations via the module survey. On non-english-locale systems, this will cause a Traceback with a UnicodeDecodeError. The cause of this is the function string.letters, called when generating the password. This return only a-z,A-Z in english locale but also special characters in other locale. The solution was to replace it with a call to string.ascii_letters, which always return a-z,A-Z. I also removed some unused code that has been there for a long time (2010) and was never used since, so it is not needed anymore. I figured that it was some old debugging code that was not removed. code is forward port from 6.1 Thanks, Ajay Chauhan -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-578969-port-cha/+merge/138964 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-opw-578969-port-cha.
=== modified file 'survey/wizard/survey_send_invitation.py' --- survey/wizard/survey_send_invitation.py 2012-11-29 22:26:45 +0000 +++ survey/wizard/survey_send_invitation.py 2012-12-10 13:36:27 +0000 @@ -53,7 +53,7 @@ } def genpasswd(self): - chars = string.letters + string.digits + chars = string.ascii_letters + string.digits return ''.join([choice(chars) for i in range(6)]) def default_get(self, cr, uid, fields_list, context=None): @@ -77,8 +77,8 @@ Would you please spent some of your time to fill-in our survey: \n%s\n You can access this survey with the following parameters: URL: %s - Your login ID: %%(login)s\n - Your password: %%(passwd)s\n + Your login ID: %%(login)s \n + Your password: %%(passwd)s \n \n\n Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)) return data @@ -87,7 +87,13 @@ if not report_name or not res_ids: return (False, Exception('Report name and Resources ids are required !!!')) try: - ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf' + # Windows: Use %temp% environment variable + if os.name == 'nt': + tempfolder = os.environ['temp'] + # Unixoid Oses: user /tmp + elif os.name == 'posix': + tempfolder = '/tmp' + ret_file_name = tempfolder + os.sep + file_name + '.pdf' service = netsvc.LocalService(report_name); (result, format) = service.create(cr, uid, res_ids, {}, {}) fp = open(ret_file_name, 'wb+'); @@ -117,7 +123,6 @@ act_id = self.pool.get('ir.actions.act_window') act_id = act_id.search(cr, uid, [('res_model', '=' , 'survey.name.wiz'), \ ('view_type', '=', 'form')]) - out = "login,password\n" skipped = 0 existing = "" created = "" @@ -130,8 +135,8 @@ for use in exist_user: new_user.append(use.id) for id in survey_ref.browse(cr, uid, survey_ids): - report = self.create_report(cr, uid, [id.id], 'report.survey.form', id.title) - file = open(addons.get_module_resource('survey', 'report') + id.title +".pdf") + report, ret_file_name = self.create_report(cr, uid, [id.id], 'report.survey.form', id.title) + file = open(ret_file_name) file_data = "" while 1: line = file.readline() @@ -140,7 +145,7 @@ break file.close() attachments[id.title +".pdf"] = file_data - os.remove(addons.get_module_resource('survey', 'report') + id.title +".pdf") + os.remove(ret_file_name) for partner in self.pool.get('res.partner').browse(cr, uid, partner_ids): if not partner.email: @@ -168,7 +173,6 @@ continue passwd= self.genpasswd() - out+= partner.email + ',' + passwd + '\n' mail= record['mail'] % {'login' : partner.email, 'passwd' : passwd, 'name' : partner.name} if record['send_mail']: vals = {
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp