On Dec 22, 2011, at 9:21 PM, Anthony wrote:
> On Thursday, December 22, 2011 9:09:22 PM UTC-5, Joseph Jude wrote:
> I used this the below in routes.in
>
> (r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>\w+)/$',
> '/init/default/index/\g<year>/\g<month/\g<slug>'),
>
> but when I go to a url
>
> localhost:/2011/11/a-slug
>
> it returns invalid request error
>
> then I tried
>
> routers = dict(
> BASE = dict(default_application = 'init',
> default_controller = 'default',
> default_function = 'index',
> ),
> )
> which gives me the error:
> invalid function (default/2011)
>
>
> I think that's supposed to work. Jonathan, is that a bug?
>
No. The problem is that the router doesn't introspect the controller, and it
doesn't know what its function names are. So it assumes that 2011 is a function
in the default controller.
For this to work, it's necessary to provide the router with a list of valid
functions in the default controller: functions = [index, whatever, ...].