[Zope-CMF] Re: removed meta_type attribute from type info classes

yuppie y.2005- at wcm-solutions.de
Fri Dec 30 05:07:37 EST 2005


Hi Rob!


Rob Miller wrote:
> yuppie, in the following change:
> 
> http://svn.zope.org/CMF/branches/1.6/CMFCore/TypesTool.py?rev=40360&r1=40267&r2=40360 
> 
> 
> you removed the 'meta_type' attribute from the FactoryTypeInformation 
> and ScriptableTypeInformation classes.  i see that this matches similar 
> changes made at the same time on the trunk, but the removal of these 
> attributes causes the Archetypes unit tests to no longer run.  do you 
> have a problem w/ readding these attributes w/ a BBB comment?

The add forms for these classes are now views, so they have to be 
registered using the five:registerClass directive instead of the 
registerClass method.

five:registerClass sets the 'meta_type' attribute on startup. If the 
attribute exists already it just overrides it, so in normal use there 
should be no problem with re-adding these attributes for 1.6.

But there is an issue with unit tests: The PlacelessSetup tear down 
removes the 'meta_type' attribute, no matter if it was added by 
five:registerClass or if it existed before. If an other test that 
doesn't use PlacelessSetup tries to access 
FactoryTypeInformation.meta_type, this will return a wrong meta type.

In CMF itself this is no problem because CMF tests use PlacelessSetup if 
they depend on those meta types. But if you run Archetypes unit tests 
(or other non-PlacelessSetup tests that depend on meta_type) together 
with the CMF tests you might see strange failures.

five:registerClass is written for classes without 'meta_type' attribute. 
To support classes with 'meta_type' attribute properly, at least the 
tear down code has to be changed. But I doubt it's worth the effort. If 
you can work around this issue I'm fine with re-adding the attributes on 
the 1.6 branch. And in 2.0 we don't have this problem anyway.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list