You can use override_template or use_custom_format, they are meant to
do right that.

On Wed, Oct 12, 2011 at 2:20 PM, Moritz Schlarb <[email protected]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi at all,
>
> I'm looking for a way to serve different page from a controller method
> without using a redirect.
>
> Basically, I have a method like this:
>
> @expose('template1')
> def method1(self,param=None):
>    if not param:
>        redirect(url('/method2'))
>    else:
>        return dict(page="method1")
>
> @expose('template2')
> def method2(self):
>    return dict(page="method2")
>
> and I don't want to loose the url entered, when method1 was invoked
> without param.
> Is there a way to achieve that without redirect?
> E.g. something like:
>    if not param:
>        return expose("template2")(method2)
>
> Thanks in advance,
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJOlYYGAAoJEEXT29373YiIdH8H/iadqrvdRnRgXdq+k3maRznV
> D6CyKtyd9DzbJHA6D87Xgem/Dk9CRbe6Mzh/K0T6/NUln1f+CHMRooBqjXpmhhCo
> crJoMtbIth0LWOjMtunp948M6NVqiqEt6jZtpjhJYJAq1V8GooK2nQISGRVmeq06
> JWM+9Ab8w/h4CHX6RDXpRaEGZFVwAl7yIqO4oEGvOj/EySTxI2IQfn7RqIplf3Fl
> fXA9Eum5DiIHIaqZdpf8iy64k017ltcqgCXc2rqNR2DzF+4IuxaTu5JW6PBolSml
> bz38nZwDvNWM/TqkCgNB48T3c+4YN3iMQmqHBUxh/VKsd2pFRRDvW2fVKwPL4/k=
> =mIyb
> -----END PGP SIGNATURE-----
>
> --
> 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.
>
>

-- 
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.

Reply via email to