On Jul 30, 2009, at 1:22 PM, LB22 wrote:

>
> Use a named buffer... I'm not sure what you mean. Could you give me an
> example of how I could rewrite my code in a more prudent way? My way
> clearly isn't prudent or I wouldn't end with 500 internal server
> errors ;o)

Rather than this:

routes_in=(
('/(([a-zA-Z0-9])*)$' , '/application/controller/function?variable=$1'),
)

this:

routes_in=(
('/(?P<args>([a-zA-Z0-9])*)' , '/application/controller/function? 
variable=\g<args>'),
)

(The terminal $ on your pattern is harmless, but not needed.)

BTW, question for someone who knows what they're doing: shouldn't  
these, on principle, be raw strings? I know that \g isn't a Python  
code, but still....


>
> Thanks
>
> On Jul 30, 9:15 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>> On Jul 30, 2009, at 12:56 PM, LB22 wrote:
>>
>>
>>
>>
>>
>>> After all of the above I was experimenting this afternoon with  
>>> masking
>>> urls (not for anything dodgy, I assure you). I'm wondering though,  
>>> why
>>> does the below provide the  work as designed on my local machine
>>> ("localhost"), but not work when on the remote server?
>>
>>> routes_in=(
>>> ('/(([a-zA-Z0-9])*)$' , '/application/controller/function?variable=
>>> $1'),
>>> )
>>
>>> routes_out=()
>>
>>> What's meant to happen is that any string of alphanumeric characters
>>> entered afterwww.domain.com/is treated as a value to be passed on to
>>> a function. If there is a trailing slash (or some other non-
>>> alphanumeric character) it fails to match and url remains as is.
>>
>>> Like I said, I'm just experimenting here, but I'd like to understand
>>> what is going wrong.
>>
>> So would I.
>>
>> The rewrite routine actually rewrites the match pattern, so it'd be
>> prudent (I think) to use a named buffer instead of $1, just in case.
> >



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

Reply via email to