" 
but /myapp/somefunction does not map to /myapp/default/somefunction because 
somefunction is interpreted as a controller in that URL (instead, it maps 
to /myapp/somefunction/index, and you get an error because such a 
controller doesn't exist).
"

so what does one do if one wants

myapp/somestuff

to map to a function that can then interpret 'somestuff' via 
response.args(0)

if one sets up defaults, then the sytstem will look for 

myapp/somestuff/index

which is not what is wanted.

Peter

On Thursday, May 17, 2012 8:44:02 PM UTC+1, AlexBenjM wrote:
>
> Hello,
>
> I'm new to web2py and am having a difficult time understanding how to use 
> either the parameter or pattern based systems as well how web2py default 
> routing works.
>
> *I'll start off with the first point of confusion for me;*
>
> The web2py book and documentation has led me to believe that the following 
> would work;
>
> http://120.0.0.1/myapp/default/somefunction can be written as 
> http://120.0.0.1/myapp/somefunction but I get invalid request error
>
> If I copy router.example.py to routes.py in the base directory, the above 
> case then works as I expected, but I thought that even with a lack of a 
> routes.py file, web2py would still automatically default to the same 
> behavior. This isn't so at all?
>
> If I then overwrite routes.py using routes.example.py, the above case no 
> longer works. Looking at both routes.example.py and router.example.py, it 
> looks like both of them configure web2py's routing behavior in the same 
> way, but the actual behavior is not the same.
>
> So I'm pretty confused about this. Note, after each changes to routes.py I 
> do reload the routes in web2py's admin console.
>
> *The second point of confusion for me is;*
> *
> *
> In the application I'm writing, which uses AJAX heavily and uses PUT and 
> DELETE in addition to GET and POST.
>
> I have in one of the controller, users, the following;
>
> def index():
>     def GET():
>        blah
>     def POST(*vars, **fields):
>       blah
>     def PUT(*vars, **fields):
>       blah
>     def DELETE(*vars, **fields):
>       blah
>
> I want to map a PUT request to users/5 to users/index/5
>
> Right now the current default routing configuration returns users/5 as 
> invalid request which is expected. Unfortunately I still don't understand 
> web2py well enough to know how to set up one of the routing systems to map 
> users/<id> to users/index/<id>
>
> I think I need to use the pattern matching system but I'm not able to get 
> it working properly.
>
> Would appreciate your tips.
>
> Thanks
> Alex
>
>

Reply via email to