[web2py] Re: Routing help with url helper

2012-11-28 Thread Ashu Verma
Hi,

Thanks for your reply. 

But still this problem will exist as 

 {{=URL(f='temp.json', hmac_key="", user_signature=True)}}  will 
output something like below : 


 '/init/default/temp.json?_signature=88c1fcf27e16dc114ba7f9ce7700fa4ae7ed7267'

$c = 'init' 
$f  = 'default'

Therefore again i will get

invalid controller (init/default)  error. 
what i want is to remove the application name from url. But urls generated 
with URL() will have the application name. how to tackle this?




On Tuesday, November 27, 2012 9:35:17 PM UTC+5:30, Massimo Di Pierro wrote:
>
> This was a tricky one. The $f does not match the extension.
>
> routes_in = (
>   (  '/$c/$f' ,  '/init/$c/$f' ),
>   (  '/$c/$f\.$e' ,  '/init/$c/$f\.$e' ),
>   (  '/$c/$f/$anything' , '/init/$c/$f/$anything' )
> )
>
> routes_out = (
>   (  ''/init/$c/$f' ,  '/$c/$f' ),
>   (  ''/init/$c/$f\.$e' ,  '/$c/$f.$e' ),
>   (  ''/init/$c/$f/$anything' , '/$c/$f/$anything' )
> )
>
> notice you cannot reverse the routes with .
>
>
>
>
> On Friday, 9 November 2012 12:37:38 UTC-6, Ashu Verma wrote:
>>
>> Hi,
>>
>> i am having the basic routing where i omitted the application name in 
>> url. Below is the content of my routes.py
>>
>> default_application = 'init'   
>> default_controller = 'default'  
>> default_function = 'index' 
>>
>> routes_in = (
>>   (  '/$c/$f' ,  '/init/$c/$f' ),
>>   (  '/$c/$f/$anything' , '/init/$c/$f/$anything' )
>> )
>>
>> routes_out = [(x, y) for (y, x) in routes_in]
>>
>>
>>
>> But when i generate a url via URL helper
>>
>> {{=URL(f='temp.json', hmac_key="", user_signature=True)}}
>>
>>
>> This will generate a URL with application name which means that 
>> application name will be treated as controller and I will get a HTTP 404. 
>>
>> So either i create my URL manually, but then i wouldn't be able to use 
>> digitally signed url  or I should modify the routes.py which I am not able 
>> to figure out without dropping the URL routing.
>>
>> Also, I tried putting a=None and a=''  in URL helper, still application 
>> name is appending.
>>
>>
>> Thank you,
>> Ashu
>>
>>
>>

-- 





[web2py] Re: Routing help with url helper

2012-11-27 Thread Massimo Di Pierro
This was a tricky one. The $f does not match the extension.

routes_in = (
  (  '/$c/$f' ,  '/init/$c/$f' ),
  (  '/$c/$f\.$e' ,  '/init/$c/$f\.$e' ),
  (  '/$c/$f/$anything' , '/init/$c/$f/$anything' )
)

routes_out = (
  (  ''/init/$c/$f' ,  '/$c/$f' ),
  (  ''/init/$c/$f\.$e' ,  '/$c/$f.$e' ),
  (  ''/init/$c/$f/$anything' , '/$c/$f/$anything' )
)

notice you cannot reverse the routes with .




On Friday, 9 November 2012 12:37:38 UTC-6, Ashu Verma wrote:
>
> Hi,
>
> i am having the basic routing where i omitted the application name in url. 
> Below is the content of my routes.py
>
> default_application = 'init'   
> default_controller = 'default'  
> default_function = 'index' 
>
> routes_in = (
>   (  '/$c/$f' ,  '/init/$c/$f' ),
>   (  '/$c/$f/$anything' , '/init/$c/$f/$anything' )
> )
>
> routes_out = [(x, y) for (y, x) in routes_in]
>
>
>
> But when i generate a url via URL helper
>
> {{=URL(f='temp.json', hmac_key="", user_signature=True)}}
>
>
> This will generate a URL with application name which means that 
> application name will be treated as controller and I will get a HTTP 404. 
>
> So either i create my URL manually, but then i wouldn't be able to use 
> digitally signed url  or I should modify the routes.py which I am not able 
> to figure out without dropping the URL routing.
>
> Also, I tried putting a=None and a=''  in URL helper, still application 
> name is appending.
>
>
> Thank you,
> Ashu
>
>
>

--