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
> > .
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
...
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)
>
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
...
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
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?
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
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
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
> 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?
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
> 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/
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
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#
> 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
> 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
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
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
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
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')
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?
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?
22 matches
Mail list logo