[Helma-user] actions
Jonathan Puckey
me at jonathanpuckey.com
Fri Oct 6 16:43:42 CEST 2006
Thanks Chris,
So I'm now doing the following:
function notfound_action(){
var href = req.path;
if(href.endsWith("/")){
res.redirect(this.href()+href.substring(0,href.length-1));
}
}
grts,
Jonathan
>
> On Oct 6, 2006, at 14:34 , Jonathan Puckey wrote:
>
>> Okay, as always with questions I found the answer after asking!
>>
>> "If the request path ends with "/", its last element will always be
>> interpreted as path element (object), not as action."
>> http://www.nabble.com/forum/ViewPost.jtp?
>> post=733368&framed=y&skin=2589
>>
>> I'm afraid users will add a trailing slash when entering the url in
>> their browser by hand.. So i'll have to look for another way..
>>
>>> Hello list!
>>> I'm currently working on my first ever Helma project, and I'm really
>>> enjoying the Helma way of doing things..
>>>
>>> I have a small question:
>>> Is it possible to make actions work with a trailing slash?
>>>
>>> http://localhost/program/current
>>> calls current_action()
>>>
>>> but http://localhost/program/current/ results in an 'object not
>>> found' error..
>>>
>>> Any tips are much appreciated!
>
> Hi Jonathan,
>
> You could write an error_action that checks whether the req.path ends
> with a slash and res.redirect to that url with the slash stripped off.
>
> Chris
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
More information about the Helma-user
mailing list