On Aug 1, 2011, at 3:21 PM, agend wrote:

> thanks, i've changed my routes.py to :
> routers = dict(
>  BASE  = dict(
>    default_application='polow',
>    default_function='show_item',
>    functions=['index', 'show_item', 'add_item']),
> )
> and it's working - but is there any way to not have to specify all my
> functions in the list - it's a bit of hassle and code duplication ?

Yeah, I know, but at least for now there's no way around it.

It'd be possible in principle to scan the controller and find all the valid 
function names (perhaps using web2py's dispatch code as a starting point), but 
that hasn't been done.

Another possible extension is to accept dicts for default_function and 
functions, where the keys would be controller names, so each controller could 
have its own function logic. But ... not yet.

> 
> Arek
> 
> On Aug 1, 11:06 pm, Jonathan Lundell <[email protected]> wrote:
>> On Aug 1, 2011, at 12:13 PM, agend wrote:
>> 
>>> all i did was set routes.py to :
>> 
>>> routers = dict(
>>>  BASE  = dict(default_application='polow'),
>>> )
>> 
>>> # where polow is my app name
>> 
>> To do what you ask (below), you need to specify show_item as the default 
>> function (only the default function is omitted), and supply a list of 
>> functions in the default controller. There's a note on it in the comments in 
>> the routers.example file.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Arek
>> 
>>> On Aug 1, 6:07 pm, Jonathan Lundell <[email protected]> wrote:
>>>> On Aug 1, 2011, at 8:55 AM, agend wrote:
>> 
>>>>> hi, what do i have to do to make a request to this address :
>>>>> example.com/345 go to example.com/show_item/345 ???
>> 
>>>>> i've already set up the default application and controller
>> 
>>>> Is show_item intended to be the default function? Are you using the 
>>>> parametric ("new") router?


Reply via email to