Hi,
Thanks your replying. I tried this:
@tg.expose()
def index(self, name, action, *args, **kwargs):
return "hello %s %s %s %s" % (name, action, args, kwargs)
But when I browse http://127.0.0.1:8080/foo/admin, I got a 404 not
found error.
And then I tired
@tg.expose()
def default(self, name, action, *args, **kwargs):
return "hello %s %s %s %s" % (name, action, args, kwargs)
It works. But here comes the problem is. How can I redirect the
request without change of url to my controller? I know that I can
redirect with redirect function like this:
@tg.expose()
def default(self, name, action, *args, **kwargs):
redirect(tg.url('/site', dict(name=name, action=action,
**kwargs)))
But...doing so will change the url. What I want is not to change the
url. Is there any way to achieve this?
Thanks.
On 2月12日, 下午10時09分, Marco Mariani <[email protected]> wrote:
> Victor wrote:
> > class Controller(tg.Controller):
> > @tg.expose()
> > def admin(self, ...):
> > pass
>
> > @tg.expose()
> > def post(self, ...)
> > pass
>
> > @tg.expose()
> > def view(self, ...)
> > pass
>
> > I want the first directory name be a parameter. Is that possible to
> > achieve this with turbogears?
>
> Just take positional parameters in your exaple.com/index controller. The
> first two will be 'tom' and 'admin', for instance.
> From there, call and redirect as you wish.
>
> @tg.expose
> def index(self, name, action, *args, **kw):
> ...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---