Hi Gilbert, ----- "Gilbert Roulot" <erlang-...@lapin-gnan-gnan.net> wrote:
> 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} -> > [ > Which version of erlydtl are you using? The one that is bundled with standard Erlang Web contains a patch for erlydtl_runtime: when accessing the request dictionary, the key will be first transformed into a string, an if the value is not found, the original atom will be used (erlydtl_runtime:18). > > 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 Thank you! Michal Ptaszek --------------------------------------------------- --------------------------------------------------- WE'VE CHANGED NAMES! Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD. www.erlang-solutions.com ------------------------------------------------------------------------------ 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 Erlangweb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/erlangweb-users http://www.erlang-web.org/