Didn't know that. Okay, modified my routes.py:
routers = dict(
BASE = dict(
default_application = 'studentstartups',
applications = ['admin', 'fruit'],
default_controller = 'default',
controllers = 'DEFAULT',
default_function = 'index',
)
)
Now with this controller:
# web2py\applications\fruit\controllers\salad.py
def index():
print 'request.args =', request.args
return str(request.args)
And with this command+output with curl:
$ curl -X GET http://localhost/fruit/salad/index/f
['f']
And with this output from server log:
request.args = ['f']
It has become obvious that only with "/index/" between "salad" and
`args` can I get anything out of request.argsā¦
=(
Bug?
On Tue, Feb 19, 2013 at 4:12 AM, Jonathan Lundell <[email protected]> wrote:
> On 18 Feb 2013, at 9:04 AM, Alec Taylor <[email protected]> wrote:
>> Thanks, what's the routes syntax to specific functions?
>>
>> This didn't work:
>>
>> fruit = dict(
>> default_function = 'index',
>> controllers = ['salad'],
>> functions = ['index','user','download','call',
>> 'data','error','profile',]
>> )
>>
>> Am I meant to specify the list in BASE?
>
> No, anything app-specific goes in the app's router.
>
> BTW, there's ordinarily no reason to list applications or controllers, unless
> you need to exclude one that's defined, because the default settings find
> them for you.
>
> If you're making the same request (http://localhost/fruit/salad/f), I think
> it should be interpreted as http://localhost/fruit/salad/index/f; that is,
> args = ['f']. What are you seeing?
>
>
>>
>> On Tue, Feb 19, 2013 at 3:49 AM, Jonathan Lundell <[email protected]> wrote:
>>> On 18 Feb 2013, at 8:38 AM, Niphlod <[email protected]> wrote:
>>>
>>> ####! Missed that.
>>>
>>> On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote:
>>>>
>>>>
>>>> You've listed salad as a function, but it's a controller.
>>>
>>>
>>> PS: Next thing to code is a small page where you load routes, a text input
>>> where you can insert an http url, and a textarea with the resulting
>>> Wsplitted" url (function, controller, args, vars, language, etc) (in & out).
>>> @Jonathan: if it's technically possible and you don't have time, I'll put in
>>> my todo-list (and enlist you as a consultant :-P)
>>>
>>>
>>> Another thing that could be helpful in debugging routes is to call URL()
>>> with specified arguments and see what it generates. That would have shown a
>>> problem with the fruit/salad router.
>>>
>>> --
>>>
>>> ---
>>> 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 [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
>
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.