-
Could you help me with the following problem: The following template code used to work with yatl: <div class="columns">
[[try:]]
[[if level == 'manager':]]
[[include 'manager_menu.html']]
<div class="column is-10">
<div class="box">
[[include]]
</div>
</div>
[[elif level == "admin":]]
[[include 'admin_menu.html']]
<div class="column is-10">
<div class="box">
[[include]]
</div>
</div>
[[else:]]
<div class="column is-12">
[[include]]
</div>
[[pass]]
[[except:]]
<div class="column is-12">
[[include]]
</div>
[[pass]] with Renoir I get the following error:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The issue seems to be the usage of Can I ask you why wrapping the entire logic in a try-except block? If I got the point you can't be sure
before the if block. Also, please open up an issue for this on the renoir repo, but mind that it will probably require quite a lot of work to be fixed. |
Beta Was this translation helpful? Give feedback.
The issue seems to be the usage of
include
insidetry
-except
blocks. Renoir parsing engine works kinda like a state machine, thus an exception outside the rendering context won't undo the processed blocks.Can I ask you why wrapping the entire logic in a try-except block? If I got the point you can't be sure
level
is defined. If that's the case, I suggest you to workaround the issue with something like:[[ level = globals().get("level", None) ]]
before the if block.
Also, please open up an issue for this on the renoir repo, but mind that it will probably require quite a lot of work to be fixed.