[Zope-CMF] Re: [dev] newstyle content creation
charlie at begeistert.org
Mon Apr 28 08:12:55 EDT 2008
Am 25.04.2008 um 19:23 schrieb Charlie Clark:
> Agreed. The first five lines are generic and should probably be in
> ContentAddFormBase leaving just the adapter stuff to be implemented
> by the view itself which is what is was before! _create would be
> more in keeping with other formlib methods such as handle_success
> calling _handle_success.
I've been successfully able to implement my own add Views for some of
my own objects and it definitely makes sense to have let
contentAddView do the work. For my objects I don't seem to need
anything specific in the view so always implementing a method such has
_create or maybe _handle_add doesn't make sense. Maybe a lookup to see
if such a method is implemented for adapting any additional adaptation?
if hasattr(self, "adapt_form_to_object"):
> Regarding naming: I suppose the easiest thing is to add an "id"
> field to the add form for none file objects. It would be nice to
> have a "require once" in the schema value for things like upload
> fields so that the same schema can be used for adding and editing.
Ha, should have looked more closely at the code! You're automatically
generating names as required. Maybe the lookup should also cope with
forms where an id is supplied just as you've done with filenames?
More information about the Zope-CMF