Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7215 Lượt xem

I was adding a condition in for my mail template.

given bellow:

%if len(l.name) > 56.0:

${l.product_id.name[28:56].ljust(28) if l.product_id else l.name[28:56].ljust(28) }

% endif

Listing the step i have done:

1) Called template._render_template() function and storing it in a text field.
2) Everything was perfect and i just added above code.

3) now showing jinja2.exceptions.TemplateSyntaxError: unexpected char '&'


Any Suggestions.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


If you have added everything correctly then you can do one thing,

you replace & to decimal char like &

You cam prepare small function to pass template string and replace & to &

I hope it will give idea.


Thanks and regards

Haresh Kansara

Ảnh đại diện
Huỷ bỏ
Tác giả

Replacing with & also same error, I tried it before. -- > jinja2.exceptions.TemplateSyntaxError: unexpected char '&'

Tác giả

I found this issue with Python version, I am using python 3.5 and this issue not showing in python 3.6 . So I am closing this issue

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 12 16
4004
2
thg 2 25
3187
1
thg 12 24
1792
1
thg 9 23
3084
1
thg 12 22
5882