[Zope-dev] Instantiating a ZClass in Zope from within a Python product

Chris McDonough chrism@digicool.com
Tue, 09 May 2000 13:25:55 -0400


This is a bug.   I suppose I should put this in the collector.  Bleah.

I found an (unsupported) way of getting at them through
the root object's _product_zclasses attribute (which holds a tuple
containing mappings describing zclasses).  This way of getting at
Zclasses is not recommended, as it's an implementation detail and not an
interface and will almost certainly change.  But...

import Zope
app = Zope.app()
myzclassstuff = app._product_zclasses

Then poke through the myzclassstuff... meta_class is the member of the
mapping that you want to look at that contains the actual class.

I found this by accident, and when I asked Jim about it I got a sidelong
glance, so you should *definitely* not base anything permanent on this
method of grabbing zclass instances.



Michael Bernstein wrote:
> 
> Chris McDonough wrote:
> >
> > Damn.  Sorry for misleading everybody!  This is only in CVS.
> 
> Ok, So is there any way (in Zope 2.1.6) to instantiate a ZClass in Zope
> from within a Python product by accessing self.Control_Panel.Products,
> or by any other means?
> 
> Is there some sort of 'Chinese Wall' between the two ways of building
> applications, or is this a bug?
> 
> Michael Bernstein.

-- 
Chris McDonough
Digital Creations
Publishers of Zope - http://www.zope.org