[Zope-CMF] Changing portal_metadata tool

Dan Keshet dkesh@channel1.com
Wed, 1 Aug 2001 17:07:03 -0400 (EDT)


On Mon, 30 Jul 2001, Tres Seaver wrote:

> > I want to add an Element to the portal_metadata tool.  Are there 
> > plans to make metadata Elements configurable?
> 
> Products.CMFDefault.MetadataTool.MetadataTool actually has methods for
> adding and removing "element specs" (which is what you want).

Aaah... I thought elements and element specs were different things.

>  The DTML does not (yet) have any UI which uses these methods,
> although adding such UI is pretty trivial.  *hacks for about 15
> minutes*.  Yep, I can now add and remove element specs on the
> "Properties" tab of the tool.  I will check the changes in shortly;

Very cool.

In case others reading want to do the same thing, here are the steps I
took after applying Tres' patch:

1) Customized metadata_edit_form to include new element, as well as other
forms for other content types (CMFEvent, etc.)

2) Customized metadata_edit python script to include new element (as well
as event_edit for CMFEvent, etc.)

3) Changed my types to support the new element. For the Default types, I
just lazily updated CMFDefault/DublinCore.py in the pattern of the others.
I don't know what the "proper" place to make a change like that is. For
the others, I subclassed them using Seb's example.

Would it be possible (or advisable) to make an editMetadata() in
PortalContent that's more generic than the DublinCore editMetadata() and
uses the portal_metadata tool to determine what elements to edit?  Then
you wouldn't have to change all your products when you want new metadata
elements.

I'm still pretty new, so I'm not sure I know what I'm talking about...