On Tuesday, October 18, 2011 4:20:55 PM UTC-4, pepper_bg wrote:
>
> I am curious about the general case of how a view file can be reused 
> but here is my specific example. I need custom user registration and 
> profile pages so my controller (default.py) looks like: 
>
> def profile(): 
>     return dict(form=generate_profile_form()) 
>
> def register(): 
>     return dict(form=generate_register_form()) 
>
> def user(): 
>     if 'register' in request.args: 
>         redirect(URL('register')) 
>     if 'profile' in request.args: 
>         redirect(URL('profile')) 
>     return dict(form=auth())
>

Rather than providing links to /user/register and then redirecting to 
/register, why not just provide links directly to /register? You don't have 
to route requests to register or to view the profile through the user 
function.

If you want the register function to use the user.html view, in the register 
function, you can do response.view = 'default/user.html'.

What does generate_register_form() do? If you want, you can generate the 
default registration form with auth.register(), and then customize the way 
it is displayed in the view.

Anthony

Reply via email to