简体   繁体   English

“context”不能用ChicagoBoss Template Tags

[英]“context” can not be used ChicagoBoss Template Tags

After upgrading ChicagoBoss to latest version (iefrom 0.8.10 -> 0.8.14) . ChicagoBoss升级到最新版本(iefrom 0.8.10 -> 0.8.14) I have been observing that the term "context" can not be used in any of the chicagoboss template tags. 我一直在观察,术语"context"不能用于任何chicagoboss模板标签。

Its giving syntax error : 它给出了语法错误:

eg. 例如。

{% if context == data.code %}
          <option selected>{{data.value1}}</option>
{% else %}
          <option selected>{{data.value2}}</option>
{% endif %}

OR 要么

{% url action="some_action" context=data.val %}

And same error thrown for these template tags : 并为这些模板标记抛出相同的错误:

Unhandled Error: error:{case_clause,{ok,[{"src/view/x_return/form_12.html",
                         [{{88,15},
                           erlydtl_parser,
                           ["syntax error before: ",["\"context\""]]}]}]}} Stacktrace: [{boss_web_controller_render,render_view,5,[{file,"src/boss/boss_web_controller_render.erl"},{line,217}]},{boss_web_controller,execute_action_inner,9,[{file,"src/boss/boss_web_controller.erl"},{line,290}]},{boss_web_controller_handle_request,process_dynamic_request,5,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,254}]},{boss_web_controller_handle_request,process_request,5,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,240}]},{boss_web_controller_handle_request,set_timer,8,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,160}]},{boss_web_controller_handle_request,build_dynamic_response,5,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,129}]},{boss_web_controller_handle_request,handle_request,4,[{file,"src/boss/boss_web_controller_handle_request.erl"},{line,26}]},{mochicow_upgrade,upgrade,4,[{file,"src/mochicow_upgrade.erl"},{line,72}]}]

It works pretty fine when I change "context" to "cntxt" or anything other than context . 当我将"context"更改为"cntxt"context以外的任何内容时,它的工作方式非常好。

As you may know that ChicagoBoss tags is just similar to Django template tags. 您可能知道ChicagoBoss标签与Django模板标签类似。 Since I followed ChicagoBoss as well as Django documentation but I could not see any documentation that "context" is keyword or any reserved term. 由于我遵循ChicagoBoss以及Django文档,但我看不到任何文档"context"是关键字或任何保留的术语。

  • Any django developer does have any idea about it? 任何django开发者都对它有任何想法吗?
  • Does it occur in Django templates also? 它是否也出现在Django模板中?

Note - I do have many files containing "context" used in template tags. 注意 - 我有很多文件包含模板标签中使用的"context" Since not a good idea to update each file to change the term manually. 因为更新每个文件以手动更改术语不是一个好主意。

context changed bing a reserved keyword in erlydtl (the Erlang implementation of the Django Template Language) in version 0.9.4, see: https://github.com/erlydtl/erlydtl/releases/tag/0.9.4 在0.9.4版本的erlydtl(Django模板语言的Erlang实现)中更改了context ,请参阅: https//github.com/erlydtl/erlydtl/releases/tag/0.9.4

So when you updated your ChicagoBoss , as a dependency you probably pulled a erlydtl versoin >= 0.9.4 所以当你更新你的ChicagoBoss ,作为一个依赖,你可能会拉一个erlydtl versoin> = 0.9.4

You could recompile ChicagoBoss after configuring a lower tag version of erlydtl in the rebar.config in the root directory of your ChicagoBoss. 您可以在ChicagoBoss根目录的rebar.config中配置较低标记版本的erlydtl后重新编译ChicagoBoss。 As an example, if you want version 0.9.3, put: 例如,如果您想要0.9.3版,请添加:

{erlydtl, ".*", {git, "git://github.com/erlydtl/erlydtl.git", {tag, "0.9.3"}}} {erlydtl,“。*”,{git,“git://github.com/erlydtl/erlydtl.git”,{tag,“0.9.3”}}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM