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 <[EMAIL PROTECTED]> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---