Merge lp:~yann-papouin/ocb-addons/6.1-bug-1276190-percentage-char-escape into lp:ocb-addons/6.1

Proposed by Yann Papouin
Status: Rejected
Rejected by: Yann Papouin
Proposed branch: lp:~yann-papouin/ocb-addons/6.1-bug-1276190-percentage-char-escape
Merge into: lp:ocb-addons/6.1
Diff against target: 12 lines (+1/-1)
1 file modified
base_action_rule/base_action_rule.py (+1/-1)
To merge this branch: bzr merge lp:~yann-papouin/ocb-addons/6.1-bug-1276190-percentage-char-escape
Reviewer Review Type Date Requested Status
Yann Papouin Disapprove
Stefan Rijnhart (Opener) Needs Fixing
Pedro Manuel Baeza code review Approve
Review via email: mp+204708@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM

Thanks for all the 6.1 bugfixing work! I insist in translate all possible unresolved bugs also to 7.0.

Regards.

review: Approve (code review)
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Yann,

looks like this patch disables all variable substitution:

    >>> '%(name)s' % {'name': 'bla'}
    'bla'
    >>> '%(name)s'.replace('%', '%%') % {'name': 'bla'}
    '%(name)s'

Not sure about the validity of this bug. You could view it as a usability issue that the templates need to be configured to contain the double % where a literal % needs to be displayed. Having this 'fixed' on the technical level would misform existing templates that already contain the double %. At this time in the 6.1 lifecycle, I would much rather simply have an additional comment on the action rule view that hints at the need for the double % to display a literal %. So would you please consider changing the view instead of the code?

review: Needs Fixing
Revision history for this message
Yann Papouin (yann-papouin) wrote :

Indeed, my "fix" totally breaks this part.

The problem initially comes from a custom module I made to replace by safe_eval all values in double brackets.
One of the value return a name with a percent inside.

review: Disapprove

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_action_rule/base_action_rule.py'
2--- base_action_rule/base_action_rule.py 2013-09-09 09:31:16 +0000
3+++ base_action_rule/base_action_rule.py 2014-02-04 15:15:39 +0000
4@@ -302,7 +302,7 @@
5 'partner_email': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and\
6 obj.partner_address_id.email) or '/',
7 }
8- return self.format_body(body % data)
9+ return self.format_body(body.replace('%','%%') % data)
10
11 def email_send(self, cr, uid, obj, emails, body, emailfrom=None, context=None):
12 """ send email

Subscribers

People subscribed via source and target branches