Merge lp:~openerp-dev/openobject-addons/7.0-opw-601752-msh into lp:openobject-addons/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-601752-msh
Merge into: lp:openobject-addons/7.0
Diff against target: 28 lines (+8/-3)
1 file modified
auth_signup/res_users.py (+8/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-601752-msh
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+197863@code.launchpad.net

Description of the change

Hello,

Fixed the issue of urllib.urlencode it does not support accented characters, need to convert it first before encoding URL.

Demo: Go to user and create user with name='mülhae blabla', you also need to have auth_signup module installed, after creating user whenever you open that user it throws traceback.

Thanks.

To post a comment you must log in.
9676. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]auth_signup: Refixed the issue of auth_signup, urllib.urlencode doesn't support accented characters, it requires utf-f encoded.

Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello,

Re-fixed the issue as per suggestion.

Thanks.

Unmerged revisions

9676. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]auth_signup: Refixed the issue of auth_signup, urllib.urlencode doesn't support accented characters, it requires utf-f encoded.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'auth_signup/res_users.py'
2--- auth_signup/res_users.py 2013-10-01 17:30:20 +0000
3+++ auth_signup/res_users.py 2013-12-06 04:57:35 +0000
4@@ -52,6 +52,11 @@
5 (not partner.signup_expiration or dt <= partner.signup_expiration)
6 return res
7
8+ def encode(self, s):
9+ if isinstance(s, unicode):
10+ return s.encode('utf8')
11+ return s
12+
13 def _get_signup_url_for_action(self, cr, uid, ids, action='login', view_type=None, menu_id=None, res_id=None, model=None, context=None):
14 """ generate a signup url for the given partner ids and action, possibly overriding
15 the url state components (menu_id, id, view_type) """
16@@ -68,10 +73,10 @@
17 fragment = {'action': action, 'type': partner.signup_type}
18
19 if partner.signup_token:
20- fragment['token'] = partner.signup_token
21+ fragment['token'] = self.encode(partner.signup_token)
22 elif partner.user_ids:
23- fragment['db'] = cr.dbname
24- fragment['login'] = partner.user_ids[0].login
25+ fragment['db'] = self.encode(cr.dbname)
26+ fragment['login'] = self.encode(partner.user_ids[0].login)
27 else:
28 continue # no signup token, no user, thus no signup url!
29