Hey,
I'm trying to save myself some code by applying multiple forms to the
same save function. Basically I have a simple and complex form that
can both be represented by the same underlying database object. The
simple form has a subset of the fields that the complex form has.
What I am trying to do is figure out a way so that the @validate
statement knows if it should be calling the simple or complex form for
validation. For example:
def get_form(self, type=None):
if type == None or type == 'simple':
return simple_form
else:
return complex_form
Then down in my save function I have:
@expose()
@validate(form=get_form('???'))
@error_handler(request)
def save(self, **kwargs):
Is there anyway to update the '???' at runtime? Is this a good path
to be going down or should I suck it up and have a copy & paste party?
Thanks for the help and ideas!
-Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---