zotonic/zotonic — Issue #256: scomp render/3: "Vars" argument looks useless
Author: helllamer
Created: 2011-11-09 13:35:27+00:00
State: open

test.tpl:
{% for i in [1,2,3] %}
{% my_scomp %}
{% endfor %}

scomp_site_my_scomp.erl:
-module(scomp_site_my_scomp).
vary(_Params, _Context) -> nocache.

render([]=_Args, Vars, Context) ->
?DEBUG(Vars),
?DEBUG(Vars == z_context:get_all(Context)),
{ok, ""}.

In console i see:
=INFO REPORT==== 9-Nov-2011::17:16:33 ===
DEBUG: scomp_site_my_scomp:5 [{session_id,"7FtjTxB006SH4J8zozkh"},
{q,[{"zotonic_host","site"},
{"zotonic_dispatch","test"},
{"z_pageid","lqBjK2YirlRjNaA3P7X4"}]},
{template,"user_events/events.tpl"},
{zotonic_dispatch,test}]

=INFO REPORT==== 9-Nov-2011::17:29:14 ===
DEBUG: scomp_site_my_scomp:6 true

As you can see, Vars argument contains absolutely same values as z_context:get_all(Context).
Expected Vars should contain 'i' variable from template.

ps: i'm trying to use scomp to emulate dynamic template inclusion.