Hi Gilbert,

I have just committed a patch which is solving the issue with keys not found in 
the dict: http://bitbucket.org/etc/erlang-web/changeset/b84207bf52bb/.
We didn't want to store keys in the dictionary as atoms to prevent user from 
creating lots of atoms in controller, which could result in system running out 
of memory and a crash.
Thank you for pointing out that issue and good luck with your further 
erlang-web development!

Kind regards,
Piotr Kaleta

----- "Gilbert Roulot" <erlang-...@lapin-gnan-gnan.net> wrote:

> On Tue, Feb 23, 2010 at 08:23:42AM +0000, Michal Ptaszek wrote:
> 
> > > 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.
> > > 
> ...
> > 
> > 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).
> > 
> Hello,
> 
> I am using erlydtl 0.5.3. I do see the code around line 18, but in my
> case find_value at line 5 is used or fetch_value at line 38. Both
> fail.
> 
> 
> fetch_value is called by the use of {{ hello }}
>      fetch_value(Key, Data) ->
>          case find_value(Key, Data) of
>              undefined ->
>                  throw({undefined_variable, Key});
>              Val ->
>                  Val
>          end.
> 
> Key: hello
> Data: [{"get",[]},
>             {"__https",false},
>             {"__ip",{194,79,152,115}},
>             {"__cookies",
>              [{"eptic_cookie","non...@nohost-9933714052825178113"}]},
>             {"session",[]},
>             {"__path",[]},
>             {"__cookie_key","non...@nohost-9933714052825178113"},
>             {"__controller",front},
>             {"hello","Hello world!"}]
> 
> find_value at line 5 is called when using {% if hello %} Hello {%
> endif %}
>      find_value(Key, L) when is_list(L) ->
>          proplists:get_value(Key, L);
> 
> Key: hello
> L: [{"get",[]},
>             {"__https",false},
>             {"__ip",{194,79,152,115}},
>             {"__cookies",
>              [{"eptic_cookie","non...@nohost-9933714052825178113"}]},
>             {"session",[]},
>             {"__path",[]},
>             {"__cookie_key","non...@nohost-9933714052825178113"},
>             {"__controller",front},
>             {"hello","Hello world!"}]
> 
> 
> Here's the relevant controller code:
> index(_Args) ->
>     wpart:fset("hello", "Hello world!"),
>     {template, "test/index.html"}.
> 
> And the template
> <html>
> <head>
> </head>
> <body>
> <h1> {% if hello %} Hello ! {% endif %}</h1>
> </body>
> </html>
> 
> 
> 
> This is on a fresh install, downloaded with 
> hg clone https://bitbucket.org/etc/erlang-web/
> 
> 
> 
> Regards
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; 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/
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG 
SOLUTIONS LTD.

www.erlang-solutions.com


------------------------------------------------------------------------------
Download Intel&#174; 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/

Reply via email to