[Zope-CMF] Re: Add forms and menus

Daniel Nouri daniel.nouri at gmail.com
Wed Jul 16 12:17:37 EDT 2008


Martin Aspeli writes:

> Daniel Nouri <daniel.nouri at ...> writes:
>
>> 
>> Robert Niederreiter writes:
>> 
>> > Am Mittwoch, den 16.07.2008, 16:24 +0200 schrieb Daniel Nouri:
>> >> Where would we need overrides.zcml?
>> 
>> > in the case where ICMFAddForm is no longer my interface to look up. then
>> > i have to overwrite the traverser.
>> 
>> Why would ICMFAddForm no longer be the interface to look up?  It's the
>> the only type of add form that promises to do something meaningful with
>> the 'portal_type' attribute that's set on it in the traverser.
>
> And even if it weren't - we shouldn't hardcode the traversal
> adapter. We should make this a convenient implementation option. The
> actual URL of the add view should configurable via a TALES expression,
> which means that it can be written without the @@add bit.

A convenient implementation option that the CMF types will need to use:
Their forms will need to depend on the @@add bit to tell them about the
portal_type.  Otherwise, if you make a copy of one of those types,
you'll end up with a form for them that creates objects of the original
type.

  class ICMFAddForm(Interface):
      portal_type = Attribute("Name of portal_type that I'm to create")

      def __call__():
          """Returns HTML"""

This should be enough as a contract for our little forms, right?


Daniel



More information about the Zope-CMF mailing list