[Zope-CMF] How to get Type in manage_afterAdd?

Jon Edwards jon@pcgs.freeserve.co.uk
Thu, 31 Jan 2002 09:50:24 -0000


I've created a new product - "organisation", which has a property
"org_type", which I set in manage_afterAdd by doing -

      self.org_type = self.portal_type

- which then gets catalogued. Works fine for the basic product, but if I use
the Portal Types tool to make a new type "Hospital", using "organisation" as
the underlying default type, it should use "Hospital" as the "org_type".

I've tried everything I can think of in place of self.portal_type
(meta_type, Type(), _getPortalTypeName(), etc.) but I still get
"organisation" instead of "Hospital" in the catalog.

There must be a way to get it, cos when I view the catalog entry for the new
item, Type is "Hospital", but org_type stubbornly refuses to find that
value! Can someone please save me from pulling out any more hair? :-)

Also, when creating a product, what's the best-practice for setting
"meta_type =" and "portal_type =" in the class? Some products use both, some
neither, some use one but not the other!

TIA

Cheers, Jon

Jon Edwards
Pricom Ltd
www.pricom.co.uk