Hopbot log for 2009-11-12 - Helma IRC channel: #helma on irc.freenode.net

2009-11-12:

[13:58] <hannesw_> emilis_info and anybody who may be interested:
[13:58] <hannesw_> I largely finished my refactoring of the helma/webapp dispatcher
[13:58] <hannesw_> and started documenting it here:
[13:58] <hannesw_> http://helma.org/wiki/Helma+NG/Request+Dispatching/
[13:59] <hannesw_> i think it's starting to make sense...
[14:38] <robi42> hannesw, nice. question: will req params be defined via regex groups?
[14:40] <robi42> i mean, args passed to resp. req dispatching module function.
[14:43] <robi42> like: http://helma.pastebin.com/m692b4433 ?
[14:48] <robi42> hannesw_, sry typo http://helma.pastebin.com/d61387f1f
[15:12] <hannesw_> robi42: yes, if you want/optionally
[15:12] <hannesw_> if your handler function defines enough parameters, all extra path elements will be passed as arguments
[15:12] <robi42> ah nice.
[15:12] <hannesw_> (without the need to define them as regexp capture groups)
[15:13] <hannesw_> but with regexp groups you have extra control
[15:13] <hannesw_> e.g. /234234.xml -> "234234", "xml"
[15:13] <hannesw_> wheres normally it would be passed as "234234.xml"
[15:14] <hannesw_> and of course things that don't match the regexp directly generate a 404, and you don't have to do that validation
[15:14] <robi42> i see. what about using a single js object literal for args?
[15:15] <hannesw_> for all args?
[15:15] <robi42> yeah
[15:15] <hannesw_> not sure I understand...
[15:15] <hannesw_> can you give an example?
[15:17] <robi42> i mean, instead of requiring the dispatching function to define an arg for every arg to handle, how about by default "stuffing" all args passed inside a single args obj?
[15:18] <hannesw_> that would be an option
[15:18] <hannesw_> for regexp groups you don't have to define arguments if you don't want to
[15:18] <hannesw_> that's only for auto-args from extra path info
[15:18] <hannesw_> and that's kind of a feature
[15:19] <robi42> how do u access/call them inside the function then?
[15:19] <hannesw_> to avoid any url to work on your action unless you actually want to
[15:19] <hannesw_> via arguments object
[15:19] <robi42> ah, i see.
[15:20] <robi42> what about generally using arguments obj instead of (optionally) defining args?
[15:21] <hannesw_> that's what I'm trying to explain...
[15:21] <robi42> ok :)
[15:21] <hannesw_> that's really a feature to keep people from fabricating urls without your app noting
[15:22] <robi42> probably will get clearer as soon as there're some additional examples on the wiki explaining those features.
[15:22] <hannesw_> imagin you have an index() function, and you can pass undefined path args to it.
[15:23] <hannesw_> that would mean any request path to just work.
[15:23] <hannesw_> like /fred/is/stupid would just return the same as /
[15:23] <hannesw_> see what i mean
[15:23] <hannesw_> ?
[15:23] <robi42> yep, potentially harmful. ;)
[15:24] <hannesw_> so for that to work, your handler function must declare formal parameters.
[15:24] <hannesw_> not for args defined via regexp groups, or args hard-coded in the urls rule
[15:25] <robi42> ok, makes sense.
[15:26] <hannesw_> sometimes simple things are hard to explain :)
[15:26] <robi42> in fact. exemplary code is better. :)
[15:27] <hannesw_> I'll try to pack some examples into http://helma.org/wiki/Helma+NG/Request+Dispatching/
[15:28] <robi42> great.

 

 

In the channel now:

Logs by date: