g-man
unread,Apr 7, 2009, 3:44:44 PM4/7/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py Web Framework
I am learning all the new auth, crud, and mail tools now, and I have
one question:
Does web2py use the 'default' controller as an implicit global
controller across a single application, or is that even possible?
Here is my situation. When I create my:
## default.py controller
def user():
return dict(form = auth())
Then I expose:
## request
application/default/user/login
Which is not as clean in terms of MVC, because I in effect have an
additional (virtual) controller (named 'user') created, which then
calls the function 'login'.
Ideally, I would like:
## request
application/user/login
...to expose the function, which would require treating 'default' as a
global controller, as it were. I tried creating a 'login' controller,
but the request still required an extra term in the request (app/login/
user/login) - not pretty.
I hate to say Rails does something like this with the 'application'
controller, because any code in that file is global to the app.
I guess what I am looking for is web2py to look in the 'default'
controller first if any parsed controller/function candidate can not
be found, and only then raise the error on failure.
That way we can have a simpler request syntax (more RESTful), and the
result would be a good fit in the case of auth, crud, and mail,
because these are usually site-wide administrative functions anyway.
Programming is fun again, thanks to web2py!