Downsides of moving from Products to lib/python?

Kai Diefenbach usenet at diefenba.ch
Wed Sep 12 10:49:01 UTC 2007


Hi, 

Maurits van Rees <m.van.rees at zestsoftware.nl>
wrote:

> The lib/python directory of a Zope instance seems to become a popular
> place for putting things and rightfully so.  I can imagine that in a
> few years time the Products dir becomes totally empty and that zope
> only uses packages in lib/python.

[Snip]

> B. Are there more of these gotchas that developers should know?

Today I run into following issue: 

>From a pure package based product (within lib/python) the initialize
method (aka: "Intializer called when used as a Zope 2 product.") within
__init__.py is not called when I run tests: zopectl test -m ...  (It is
when the instance is started normally: e.g. zopectl fg)

This means - since I use AT based types - that the types are not
registered appropriate, hence they can not added within the portal:

   [...] raise AccessControl_Unauthorized('Cannot create %s' %    
   self.getId()) Unauthorized: Cannot create Company

I wonder about two things now:

1.
How can I make Zope call the initialize method for tests as it does when
it starts the normal way?

2. 
When Zope calls the initialize method it passes an instance of
App.ProductContext.ProductContext, which is needed to initalize the
content_types. 

As I'm able to call the initialize method explicitely within my TestCase
I would like to know how can I get on this ProductContext instance? Or
how can I create one, which is appropriate?

Thanks
Kai∆

-- 
Kai Diefenbach - http://diefenba.ch
iqplusplus - http://iqpp.de





More information about the Product-Developers mailing list