Erlang Mailing Lists

Author Message

<  Erlang Web mailing list  ~  [Erlangweb-users] Possible error in tutorial step 2

jeffm
Posted: Mon Mar 22, 2010 8:25 am Reply with quote
User Joined: 29 Sep 2008 Posts: 43
I notice that the following code causes a 501 error,

do_add(_Args) ->
case validate_tool:validate_cu(item, create) of
{ok, Item} ->
wtype_item:create(Item),
{redirect, "/item/all"};
{error, _Reason} ->
wpart:fset("__edit", wtype_item:prepare_validated()),
{template, "/item/add.html"}
end.

but changing the template line to, note lack of leading slash,

{template, "item/add.html"}

fixes the problem. This appear to be what it should be as the matching
instructed entry for dispatch.conf is

{static, "^/item/add$", "item/add.html"}.


Jeff.


------------------------------------------------------------------------------
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/
Post received from mailinglist
View user's profile Send private message
Guest
Posted: Mon Mar 22, 2010 9:31 am Reply with quote
Guest
Hi,
You are right, there should be no leading slash.

Lack of leading slash emphasis that it is not absolute path to templates.

The path in return tuple (like {template, ..path..}) is trailing part of final path, which is build basing on root_template environment variable (by default it is "/<server_path>/templates").

To see how it is used and how to modify defaults see eptic/src/e_conf.erl (line 366).


Michal Zajda

----- "jm" <jeffm@ghostgun.com> wrote:

> I notice that the following code causes a 501 error,
>
> do_add(_Args) ->
> case validate_tool:validate_cu(item, create) of
> {ok, Item} ->
> wtype_item:create(Item),
> {redirect, "/item/all"};
> {error, _Reason} ->
> wpart:fset("__edit", wtype_item:prepare_validated()),
> {template, "/item/add.html"}
> end.
>
> but changing the template line to, note lack of leading slash,
>
> {template, "item/add.html"}
>
> fixes the problem. This appear to be what it should be as the matching
>
> instructed entry for dispatch.conf is
>
> {static, "^/item/add$", "item/add.html"}.
>
>
> Jeff.
>
>
> ------------------------------------------------------------------------------
> 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/

--
Michal Zajda

Erlang Solutions Ltd.
http://www.erlang-solutions.com
---------------------------------------------------

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

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/
Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum