[Dev] Kinds without Classes (please read)

Andi Vajda vajda at osafoundation.org
Fri Jul 16 08:21:07 PDT 2004


Donn found a bug he describes below where the item class of Kinds whose item 
class is not specified defaults to Item instead of a composite of the 
kind's superKinds item classes (a kind's item class is the python class used 
to instantiate items of that kind).

I fixed this bug to compose a class from the kind's superKinds if the kind's 
item class is not specified. Hence, some of your items may now be of a class 
you don't expect instead of being of class Item.

The kinds in Chandler that are affected are:

   - //parcels/osaf/contentmodel/MailedEventTask
   - //parcels/osaf/contentmodel/EventTask
   - //parcels/osaf/contentmodel/MailedEvent
   - //parcels/osaf/contentmodel/MailedTask

The attached t39.py file can be run in Chandler from PyCrust.
t39.l2 contains the list of affected kind paths.

Andi..

---------- Forwarded message ----------
Date: Thu, 15 Jul 2004 18:02:51 -0700
From: Donn Denman <donn at osafoundation.org>
To: Andi Vajda <vajda at osafoundation.org>
Subject: Kinds without Classes

Andi,

I noticed that a Kind without any "classes" attribute doesn't get any default 
class (other than Item).  If the Kind has one or more superKinds, would it be 
reasonable to composite a class in the same way you do for mixinKinds?

This came up in a code review of Stamping.  I have two ways to do stamping; by 
using mixinKinds() OR by assigning a pre-built Kind to self.itsKind.  In the 
mixinKinds() case you build the class for me, but when I have a predefined Kind 
that's just a combination of other superKinds I have to prebuild the class too.

- Donn
-------------- next part --------------

from application.Globals import repository as rep
from repository.item.Query import KindQuery
from repository.item.Item import Item

k = rep.findPath('//Schema/Core/Kind')
q = KindQuery()

l0 = q.run([k])
l1 = [k for k in l0
      if k.getItemClass() is not Item and k._values._isTransient('classes')]
l2 = [k.itsPath for k in l1]


More information about the Dev mailing list