On Fri, Feb 19, 2010 at 08:44:50AM +0000, Michal Ptaszek wrote:
> Hi,
>
> We are very happy with the patches you provided:
> good job! Both of them have been applied on the
> Erlang Web's sources (changeset 4a2530c5e23d) and
> will be included in the next release.
>
> Thank you for your contribution!
>
You're welcome.
I found another issue with DTL. When I use {{ variable }} in a template,
and set the value with wpart:fset("variable", "Hello"). Erlydtl doesn't find
it.
What happens is erlydtl_runtime:fetch_value is looking for the atom viariable in
the dictionary, but the dictionnary has string keys. wpart:fset(variable,
"Hello")
doesn't work.
In order to fix this, I modified the dictionnary passed to erlydtl_runtime to
turn
its keys from strings into atoms:
--- a/lib/wpart-1.4/src/erlydtl_expander.erl Tue Jan 19 10:58:02 2010 +0100
+++ b/lib/wpart-1.4/src/erlydtl_expander.erl Fri Feb 19 18:32:39 2010 +0100
@@ -24,7 +24,10 @@
process_xml(Mod) ->
case e_dict:get_state() of
- {ok, Dict} ->
+ {ok, Dict1} ->
+ % turn strings in Dict1 into atoms. Because erldtl
+ % looks for atoms in it
+ Dict = lists:map(fun ({Key, Value}) -> {list_to_atom(Key), Value}
end, Dict1),
case Mod:render(Dict) of
{ok, Html} ->
[
I'll contribute patches as I go if more are needed. I guess DTL support doesn't
see lots
of use along erlang-web users :)
Regards
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Erlangweb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/erlangweb-users
http://www.erlang-web.org/