[web2py] Re: default function of a controller

2011-08-05 Thread Anthony
On Friday, August 5, 2011 6:26:04 AM UTC-4, Francisco Costa wrote: > > > > On Aug 5, 12:54 am, pbreit wrote: > > That should be easy to support. In default.py: > > > > def user(): > > if request.args(0): > > user = request.args(0) > > ... > > else: # list > > .

[web2py] Re: default function of a controller

2011-08-05 Thread pbreit
Then this should work: === user.py === def index() if request.args(0): user = request.args(0) ... else: # list ... === restuarant.py === def index() if request.args(0): user = request.args(0) ... else: # list ...

[web2py] Re: default function of a controller

2011-08-05 Thread Francisco Costa
On Aug 5, 12:54 am, pbreit wrote: > That should be easy to support. In default.py: > > def user(): >     if request.args(0): >         user = request.args(0) >         ... >     else: # list >     ... > > def restaurant(): >     if request.args(0): >         restaurant = request.args(0) >      

[web2py] Re: default function of a controller

2011-08-04 Thread pbreit
That should be easy to support. In default.py: def user(): if request.args(0): user = request.args(0) ... else: # list ... def restaurant(): if request.args(0): restaurant = request.args(0) ... else: # list ...

[web2py] Re: default function of a controller

2011-08-04 Thread Francisco Costa
I have controller over my URLs I have this controller 'user' with 2 functions: index(list of users), view(user details) I have another controller 'restaurant' with 2 functions: index(list of restaurants), view(restaurant details) I wanted to have this urls: http://domain.com/user/mcdonalds and ht

[web2py] Re: default function of a controller

2011-07-12 Thread pbreit
How do you want it to work exactly? Can you show us an example? And what are your constraints? Do you not have control over your URLs?

[web2py] Re: default function of a controller

2011-07-12 Thread Ross Peoples
If your controller doesn't have an index function at all, you could add something like this to one of your models: if request.controller = 'mycontroller' and request.function == 'index': request.function = 'myfunction' So that if someone tries to go to /mycontroller or /mycontroller/index, t

[web2py] Re: default function of a controller

2011-07-12 Thread Francisco Costa
On Jun 14, 7:57 pm, Jonathan Lundell wrote: > On Jun 14, 2011, at 11:42 AM, Francisco Costa wrote: > > > > >> You can only do this for the default controller. You do it by specifying a > >> list of the functions in the default controller: functions = [...]. > > > I have that for the default contr

Re: [web2py] Re: default function of a controller

2011-06-14 Thread Jonathan Lundell
On Jun 14, 2011, at 11:42 AM, Francisco Costa wrote: > >> You can only do this for the default controller. You do it by specifying a >> list of the functions in the default controller: functions = [...]. > > I have that for the default controller, but in this case I need to > have it in a non-de

[web2py] Re: default function of a controller

2011-06-14 Thread Francisco Costa
> You can only do this for the default controller. You do it by specifying a > list of the functions in the default controller: functions = [...]. I have that for the default controller, but in this case I need to have it in a non-default controller It's not possible to have this feature?

Re: [web2py] Re: default function of a controller

2011-06-14 Thread Jonathan Lundell
On Jun 14, 2011, at 11:28 AM, Francisco Costa wrote: > >> Well, it does support matching the host name, so I suppose it should be >> doable. > > And in the Parameter-Based System how do you bypass a function in the > url > > Something like this: http://domain.com/app/controller/arg1/ You can on

[web2py] Re: default function of a controller

2011-06-14 Thread Francisco Costa
> Well, it does support matching the host name, so I suppose it should be > doable. And in the Parameter-Based System how do you bypass a function in the url Something like this: http://domain.com/app/controller/arg1/

[web2py] Re: default function of a controller

2011-06-14 Thread Anthony
On Tuesday, June 14, 2011 2:13:38 PM UTC-4, mwolfe02 wrote: > > Someone please correct me if I'm wrong, but I believe the Pattern- > Based System supports URL re-writing different domains to different > applications. Well, it does support matching the host name, so I suppose it should be doa

[web2py] Re: default function of a controller

2011-06-14 Thread mwolfe02
Someone please correct me if I'm wrong, but I believe the Pattern- Based System supports URL re-writing different domains to different applications. On Jun 14, 1:56 pm, Francisco Costa wrote: > > If you use the parameter-based URL rewrite system > > (seehttp://web2py.com/book/default/chapter/04#

[web2py] Re: default function of a controller

2011-06-14 Thread Francisco Costa
> If you use the parameter-based URL rewrite system > (seehttp://web2py.com/book/default/chapter/04#Parameter-Based-System), you can > specify default_function in either the BASE router or an application > specific router, but I think that would set the default function for all > controllers, not

[web2py] Re: default function of a controller

2011-06-14 Thread Francisco Costa
> Actually, redirect takes a URL, so you can pass the args to the URL > function: > > redirect(URL('other_controller', 'other_function', args=request.args, > vars=request.vars)) I didn't know that > I'm not sure I would recommend the redirect method, though -- it generates a > new request, so int

[web2py] Re: default function of a controller

2011-06-14 Thread Anthony
On Tuesday, June 14, 2011 1:32:36 PM UTC-4, Francisco Costa wrote: > > > But why change this? I always advise not changing this. One thing you > could > > do instead is: > > > > def index(): > > redirect('other_controller', 'other_function') > > That solution doesn't work for me because

[web2py] Re: default function of a controller

2011-06-14 Thread Francisco Costa
On Jun 14, 6:25 pm, pbreit wrote: > You can set default_controller and default_function in routes.py but that > changes it for your whole app. Yes, I have index as the default function but for a specific controller I want it to be a different default function. > But why change this? I always a

[web2py] Re: default function of a controller

2011-06-14 Thread Anthony
On Tuesday, June 14, 2011 6:55:11 AM UTC-4, Francisco Costa wrote: > > Hello, > > I have this controller (not the default one) that I would like to have > a default function (not index) > > How can I do that? If you use the parameter-based URL rewrite system (see http://web2py.com/book/defa

[web2py] Re: default function of a controller

2011-06-14 Thread pbreit
You can set default_controller and default_function in routes.py but that changes it for your whole app. But why change this? I always advise not changing this. One thing you could do instead is: def index(): redirect('other_controller', 'other_function')

[web2py] Re: default function of a controller

2011-06-14 Thread Tiago Moutinho
I also want to know that.. its in the routes?? On Jun 14, 11:55 am, Francisco Costa wrote: > Hello, > > I have this controller (not the default one) that I would like to have > a default function (not index) > > How can I do that?

[web2py] Re: default function of a controller

2011-06-14 Thread Francisco Costa
is this possible? On Jun 14, 11:55 am, Francisco Costa wrote: > Hello, > > I have thiscontroller(not thedefaultone) that I would like to have > adefaultfunction(not index) > > How can I do that?