2012-08-23 2 views
5

제 GAE-python 프로젝트에서 jinja2 templating language를 사용하고 있습니다. 파일 업로드에 jquery-upload을 사용하려고했습니다.진자와 자바 스크립트 구문이 충돌하나요?

다음 코드는 오류를 던지고있다 :

<!-- The template to display files available for upload -->¬ 
    152 <script id="template-upload" type="text/x-tmpl">¬ 
-- 153  {% for (var i=0, file; file=o.files[i]; i++) { %}¬ 
| 154  <tr class="template-upload fade">¬ 
| 155   <td class="preview"><span class="fade"></span></td>¬ 
|- 156   <td class="name"><span>{%=file.name%}</span></td>¬ 

위의 코드는 직접 JQuery와 업로드 라이브러리에서 가져옵니다.

오류 :

line 153, in template 
    {% for (var i=0, file; file=o.files[i]; i++) { %} 
TemplateSyntaxError: expected token ')', got 'i' 

I 그것이 의한 텍스트/X-tmpl JS 구뿐만 아니라 jinja2 사용되는 {% %}시킨다 생각되고있다. 이 올바른지? 그렇다면 어떻게 해결할 수 있습니까? 도와주세요.

{{ '{% for (var i=0, file; file=o.files[i]; i++) { %}' }} 

을 또는 당신은 {% 원시 %} {% endraw의 %} 블록을 사용할 수 있습니다

답변

관련 문제