0k / web_ckeditor

CKEditor module for OpenERP
4 stars 2 forks source link

Failed to render mako template value #4

Open haylahi opened 11 years ago

haylahi commented 11 years ago

Hi vaab,

To reproduce this error : 1- Go to menu -> Settings -> Email -> Template 2- Edit email template with ckeditor widgt (ex. Send order - send by email) 3 - Try to send an email with this template in qutotation form ; you receive this error in log:

openerp.addons.email_template.email_template: failed to render mako template value u'<div style="font-family: \'Lucica Grande\', Ubuntu, Arial, Verdana, sans-serif; font-size: Traceback (most recent call last): File "/home/haylahi/workspace/OE_70/server/openerp/addons/email_template/email_template.py", line 98, in render_template result = mako_template_env.from_string(template).render(variables) File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 769, in from_string return cls.from_code(self, self.compile(source), globals, None) File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 493, in compile self.handle_exception(exc_info, source_hint=source) File "", line 4, in template TemplateSyntaxError: unexpected char u'&' at 222

vaab commented 11 years ago

Hi, thank for you thorough usage of web_ckeditor.

I looked at your case, but it seems to me that it could be a bad idea to use web_ckeditor in these mail templates as they are not pure HTML (that's what CKEditor will produce), but mako templates -- which is a template language used to produce HTML. As I understand it, it seems to me foreseeable that issues will happen by doing that.

However, I tried to reproduce your bug, and I installed "Sale", modified the template, saved it, and used "Send a Mail" button in Quotation form, and it worked (and it is a surprise for me ;) ).

I'm using Chrome.

We are chasing a syntax error in the email template. Can you send me the body_html database content of your quotation sale ? You can find it in the "email_template" table in the openerp database.

Many thanks.