[Zope-CMF] Add metadata elements in Product init?

Jon Edwards jon@pcgs.freeserve.co.uk
Sat, 9 Feb 2002 16:01:28 -0000


I want my product to add some extra metadata elements for all content types
in a portal ('menusortorder' for example). So I've been digging round in
MetadataTool.py trying to find the way that involves least
hacking/sub-classing so that nothing breaks when the underlying code is
upgraded :-)

So I was wondering if I can add the extra elements in my product's init.py?
That way I don't have to subclass MetadataTool?

Near the top of MetadataTool, there's a DEFAULT_ELEMENTS_SPECS, so I was
wondering if I could put -

DEFAULT_ELEMENT_SPECS = ( ( 'Title', 0 )
                        , ( 'Description', 0 )
                        , ( 'Subject', 1 )
                        , ( 'Format', 0 )
                        , ( 'Language', 0 )
                        , ( 'Rights', 0 )
                        , ( 'menusortorder', 0)
                        , ( 'newelement2', 0)
                        , ( 'newelement3', 0)
                        )

- in my init.py, then somehow force MetadataTool to reinitialise with these
values?

Am I on the wrong track? Am I better off sub-classing MetadataTool?

TIA

Cheers, Jon