Am 02.05.2008 um 13:50 schrieb yuppie:
Did some more refactoring. If your factory can handle all the input,
ContentAddFormBase's 'create' method should be sufficient. If not,
you need a 'create' method like the one in FileAddView.
Done quite a lot of Add Forms based on your work and we ended up
extended the base view to implement form_fields and require the sub
classes to provide the portal_type and the schema or list of fields.
@property
def form_fields(self):
fields = form.FormFields(
TextLine(
__name__='portal_type',
default=self.portal_type)
)
# allow sub-classes to pass in sequences of schema
if isinstance(list, self.schema):
for s in self.schema:
fields += form.FormFields(s)
else:
fields += form.FormFields(self.schema)
return fields
I'm not sure if it's overkill to be able to handle a list of fields
but we've found it makes views a lot easier to work with. What do you
think?
Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests