On Tue, 18 Jul 2006 14:30:14 -0700 (PDT)
Donald Ball <[EMAIL PROTECTED]> wrote:

> 
> On Tue, 18 Jul 2006, Donald Ball wrote:
> 
> > Apologies for my appalling ignorance, but I'm having trouble with
> > the lack of forms widget documentation. :) If I'm able to get this
> > identity management app working, I'll be happy to wiki it on up for
> > others to learn from.
> 
> And for once, I've solved my own problem. fwiw, the form template
> ought to read:
> 
>      <p py:content="form.display(user, action=action)">Comment
> form</p>
> 
> and the final editUser method:
> 
>      @expose(template=".templates.form")
>      def editUser(self, tg_errors=None, *args, **params):
>          if tg_errors:
>              turbogears.flash("Error on form: " + str(tg_errors))
>          id = params.get("id", None)
>          if (id):
>              try:
>                  user = User.get(id)
>                  user_form.display(user)
>              except SQLObjectNotFound:
>                  raise NotFound()
>          else:
>           user = None
>       return dict(form=user_form, user=user, action='saveUser',
> title='Edit User')
> 
> Now I just need to figure out how to allow the form to have multiple 
> submit buttons (edit, delete) - conditionally enabled based on the
> user's privileges - and then I'll really be jamming.
> 
> - donald

Just so you know, the user_form.display(user) line in there isn't
needed and just takes up processing.  You're doing exactly the same
thing in the template with form.display(user, action=action), except
the output is actually being displayed...

Jason

Attachment: signature.asc
Description: PGP signature

Reply via email to