Right now using the Parameter-based system for routing if we want to define 
different default_function for each controller we must set a list of all 
controllers, and then a dictionary with a list of all functions in each 
controller.

    blog=dict(
        controllers=['posts', 'comments'],
        functions=dict(
            posts=['list', 'create', 'show', 'edit', 'delete'],
            comments=['list', 'create', 'show', 'edit', 'delete'],
        ),
        default_controller='posts',
        default_function=dict(
            posts='list',
            comments='show',
        )
    ),


Why is this truly necessary? Shouldn't we just set the default_controller 
and default_function for each controller like bellow?

    blog=dict(
        default_controller='posts',
        default_function=dict(
            posts='list',
            comments='show',
        )
    ),

It would save lots of time, because every time you add a new controller or 
function you have to set it in routes and restart the server. And if you 
have lots of functions, and you access them with .json extension you also 
have to set those on the list like 'create.json'

On Tuesday, July 10, 2012 5:05:44 PM UTC+1, Jonathan Lundell wrote:
>
> On 10 Jul 2012, at 6:14 AM, Anthony wrote:
>
> Thanks Anthony and Jonathan. It works!
>> It would be nice to have this routing documentation updated in the online 
>> book.
>>
>
> +1
>
> For now, there's quite a bit in the routers.example.py file (including 
> the detail about making "functions" a dictionary of lists).
>
>
> One reason that the documentation is more up to date in the example file 
> is that it tracks the relevant version. As opposed to the book, where one 
> doesn't want to change the docs until the changes make it to stable. 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to