Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  cut/paste instead of erlyweb_magic

Guest
Posted: Wed Mar 05, 2008 5:12 am Reply with quote
Guest
Hi all,
so i wanted to play around with the erlyweb_controller functions
without messing around with the file itself. so i cut and pasted all
its code (changed module declarations of course) into the music app's
musician_controller.erl, and same with erlyweb_view.et's code into
musician_view.et (got rid of the generated musician_view.erl). This
compiles just fine, but when i check it out in the browser, i get
errors. I thought erlyweb_magic() just extended the modules, so i
don't understand why the code wouldn't work when it's just pasted in.
specifically the errors are:
ERROR erlang code crashed:
File: appmod:0
Reason: {no_such_function,{"musician","index",1}}
Req: {http_request,'GET',{abs_path,"/music/musician"},{1,1}}

I looked at index(), and this is right: it takes a model along with a
yaws arg (somehow this was handled just fine before...) so since the
data is stored in a table called 'musician', i tried:

http://localhost:8080/music/musician/index/musician

the url redirects to: http://localhost:8080/music//musician/list/1
and it says:
ERROR erlang code crashed:
File: appmod:0
Reason: {badarg,[{erlang,apply,["1",find_range,[]]},
{musician_controller,list,3},
{erlyweb,ewc,2},
{erlyweb,handle_request,6},
{yaws_server,deliver_dyn_part,8},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p,5}]}
Req: {http_request,'GET',{abs_path,"/music/musician/list/1"},{1,1}}

i looked at list/3 but can't figure out what went wrong. am i missing
something that makes the erlyweb_magic stuff work while this doesn't?

Thanks,
Liron Greenstein

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Mar 05, 2008 5:28 am Reply with quote
Guest
Hi Liron,

erlyweb_magic does do one more thing besides just extension: it adds a
few additional functions if they don't already exist, and it replaces
the 'Model' parameter of controller functions with a statically bound
variable. If you just copy this code and try to run it without
erlyweb_magic, it would break. To see how to works, check out the
add_forms function in erlyweb_compile.

Yariv

On Tue, Mar 4, 2008 at 9:12 PM, Liron Greenstein <Liron86@gmail.com> wrote:
>
> Hi all,
> so i wanted to play around with the erlyweb_controller functions
> without messing around with the file itself. so i cut and pasted all
> its code (changed module declarations of course) into the music app's
> musician_controller.erl, and same with erlyweb_view.et's code into
> musician_view.et (got rid of the generated musician_view.erl). This
> compiles just fine, but when i check it out in the browser, i get
> errors. I thought erlyweb_magic() just extended the modules, so i
> don't understand why the code wouldn't work when it's just pasted in.
> specifically the errors are:
> ERROR erlang code crashed:
> File: appmod:0
> Reason: {no_such_function,{"musician","index",1}}
> Req: {http_request,'GET',{abs_path,"/music/musician"},{1,1}}
>
> I looked at index(), and this is right: it takes a model along with a
> yaws arg (somehow this was handled just fine before...) so since the
> data is stored in a table called 'musician', i tried:
>
> http://localhost:8080/music/musician/index/musician
>
> the url redirects to: http://localhost:8080/music//musician/list/1
> and it says:
> ERROR erlang code crashed:
> File: appmod:0
> Reason: {badarg,[{erlang,apply,["1",find_range,[]]},
> {musician_controller,list,3},
> {erlyweb,ewc,2},
> {erlyweb,handle_request,6},
> {yaws_server,deliver_dyn_part,8},
> {yaws_server,aloop,3},
> {yaws_server,acceptor0,2},
> {proc_lib,init_p,5}]}
> Req: {http_request,'GET',{abs_path,"/music/musician/list/1"},{1,1}}
>
> i looked at list/3 but can't figure out what went wrong. am i missing
> something that makes the erlyweb_magic stuff work while this doesn't?
>
> Thanks,
> Liron Greenstein
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Mar 05, 2008 5:56 am Reply with quote
Guest
Liron Greenstein wrote:
> Hi all,
> so i wanted to play around with the erlyweb_controller functions
> without messing around with the file itself. so i cut and pasted all
> its code (changed module declarations of course) into the music app's

just quickly. Did you turn erlyweb_magic(off) or comment it out?


Jeff.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Mar 05, 2008 12:53 pm Reply with quote
Guest
Ohh ok, so more was going on than i thought. I just commented out the
erlyweb_magic declaration, would it work with erlyweb_magic(off)?
I'll try it when I get back to the cs lab.. Thanks for the info!

Liron Greenstein

On Mar 5, 12:17 am, jm <je...@ghostgun.com> wrote:
> Liron Greenstein wrote:
> > Hi all,
> > so i wanted to play around with the erlyweb_controller functions
> > without messing around with the file itself. so i cut and pasted all
> > its code (changed module declarations of course) into the music app's
>
> just quickly. Did you turn erlyweb_magic(off) or comment it out?
>
> Jeff.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Mar 05, 2008 4:30 pm Reply with quote
Guest
How can you turn the ErlyWeb magic off? Wink

/David

On Mar 5, 2008, at 12:17 AM, jm wrote:

>
> Liron Greenstein wrote:
>> Hi all,
>> so i wanted to play around with the erlyweb_controller functions
>> without messing around with the file itself. so i cut and pasted all
>> its code (changed module declarations of course) into the music app's
>
> just quickly. Did you turn erlyweb_magic(off) or comment it out?
>
>
> Jeff.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived 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