#2393: Forms with nested schemas
---------------------------------------------+------------------------------
 Reporter:  guest                            |        Owner:  Chris Arndt 
     Type:  defect                           |       Status:  assigned    
 Priority:  normal                           |    Milestone:  1.0.x bugfix
Component:  TG Widgets                       |      Version:  1.1         
 Severity:  normal                           |   Resolution:              
 Keywords:  needs review, forms, FormEncode  |  
---------------------------------------------+------------------------------
Changes (by Chris Arndt):

  * keywords:  forms, FormEncode => needs review, forms, FormEncode

Comment:

 I added a patch, which allows to define nested schemas as shown in my
 previous comment and use them with nested widget forms.

 The file `forms.py` in your example app should be fixed to look like the
 following to make it work with this patch:

 {{{
 from turbogears.widgets import *
 from turbogears.validators import *


 class PersonForm(ListForm):
     class PersonFields(WidgetsList):
         class NameFields(WidgetsList):
             firstname = TextField(label=_(u'Firstname'))
             lastname = TextField(label=_(u'Lastname'))

         namefields = FieldSet(
             legend = _(u"Name"),
             fields = NameFields()
         )

         class ContactFields(WidgetsList):
             email = TextField(label=_(u"Email address"))

         contact = FieldSet(
             legend = _(u"Contact"),
             fields = ContactFields()
         )

     class PersonSchema(Schema):
         class namefields(Schema):
             firstname = UnicodeString(strip=True, not_empty=True, max=20)
             lastname = UnicodeString(strip=True, not_empty=True, max=20)

         class contact(Schema):
             email = Email(not_empty=True)

     fields = PersonFields()
     validator = PersonSchema()
 }}}

 Can you test this with your real application? I'm unsure whether I have
 considered all the implications of this change.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2393#comment:5>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to