[Zope-CMF] How to save extra data with CMF-object

Tres Seaver tseaver@palladion.com
Mon, 16 Jul 2001 10:58:06 -0400 (EDT)


On Fri, 13 Jul 2001, seb bacon wrote:

> * Tres Seaver <tseaver@palladion.com> [010712 23:16]:
> > On Thu, 12 Jul 2001, Robert Rottermann wrote:
> > 
> > > Do I have to "misuse" one of the standard metadata fields I
> > > do not need, or is there an other way to go.
> 
> < snip >
> 
> > It turns out that CMFDefault.DefaultDublinCoreImpl derives
> > (for unknown reasons) from PropertyManager;  therefore, virtually
> > all content objects can have custom properties added to them!
> > 
> > As to whether this is a Good Thing (tm), I am of a divided mind.
> > I can't see any reason that DDCI *needs* to have such a base
> > class, but it does make "quick-and-dirty" custom schema simple.
> 
> What are the arguments for / against, in your mind?

PropertyManager is somewhat icky from the perspective of
maintainability:

 - It is a "flat" namespace;  in fact, it stores properties in the
   as normal Python attributes of the instance.

 - The schema has to be set "programatically", which means that
   updating older instances it hard.

 - One can't look at a central location (e.g., the Python class,
   or ZClass, or the type object) to determine the schema for all
   objects of a given type.
 
> I guess one Bad Thing is that the PropertyManager is not very
> OOP-minded / NewReligionesque; however, to encapsulate it a bit
> better, it wouldn't be very difficult to add getPropertyFor() and
> setPropertyFor() methods to the PropertiesTool, perhaps?

That would fix the cosmetics (exposing PropertyManager), but not
the more substantive issues.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org