Keith R. Fieldhouse wrote:
>
> Aha.  I was starting to look at someting like that and decided I was
> missing something.  I 'm really glad to see this patch both becuase it
> lets me do what I want and it's confirmation that I really was beginning
> to "get" the way widgets work.
>
> I agree that something like this should be generally possible.  In my
> experience, form layout ("can you put this next to this...") is one of
> the classic bike sheds in web development.  It'll be nice to be able to
> keep everthing associted with a form's structure encapsulated in one
> place in my code...

IMHO putting "field_for" in the template scope of a form widget doesn't
make much sense since you can use it "only" if you know the form
structure (fields names) before doing the template and that's not the
use case of a form widget, OTOH I can't see any arm in putting it
there.

You can also do something like this if what you need is just
encapsulating the layout:

class FormFields(WidgetsDeclaration):
     name = TextField()
     age = TextField()

MyFormLayout(Widget):
    template_vars = ['form']
    template = """
    <p py:content="form.field_for(name)"
    """

then:

form = Form(fields=FormFields())
form_layouted = MyFormLayout(form)

and use @validate(form).

Keep in mind that I haven't tested this.

Ciao
Michele


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

Reply via email to