콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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.


아바타
취소
베스트 답변

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

아바타
취소
작성자

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

작성자

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

관련 게시물 답글 화면 활동
0
12월 16
4003
2
2월 25
3183
1
12월 24
1788
1
9월 23
3082
1
12월 22
5881