Discussion:
[Modeling-users] ZModelizationTool Importing into Zope failure
W.J. MacIsaac
2004-02-22 01:38:03 UTC
Permalink
I've gone wrong somewhere, but I'm at a loss as to say how. Can anyone
diagnose this?

Zope runs fine without trying to import the tool.

Thanks,
Jeff


[***@shackleton Zope-2.7.0]$ ./bin/runzope
------
2004-02-21T17:34:27 INFO(0) ZServer HTTP server started at Sat Feb 21 17:34:27 2004
Hostname: shackleton
Port: 8080
------
2004-02-21T17:34:27 INFO(0) ZServer FTP server started at Sat Feb 21 17:34:27 2004
Hostname: shackleton
Port: 8021
------
2004-02-21T17:34:28 ERROR(200) Zope Could not import Products.ZModelizationTool
Traceback (most recent call last):
File "/usr/src/Zope-2.7.0/lib/python/OFS/Application.py", line 654, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/usr/src/Zope-2.7.0/Products/ZModelizationTool/__init__.py", line 28, in ?
import ZModelizationTool
File "/usr/src/Zope-2.7.0/Products/ZModelizationTool/ZModelizationTool.py", line 40, in ?
from Modeling.Entity import Entity
File "/usr/lib/python2.3/site-packages/Modeling/Entity.py", line 121, in ?
class Entity(base_object, XMLCapability, Persistent, KeyValueCoding):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Traceback (most recent call last):
File "/usr/src/Zope-2.7.0/lib/python/Zope/Startup/run.py", line 49, in ?
run()
File "/usr/src/Zope-2.7.0/lib/python/Zope/Startup/run.py", line 19, in run
start_zope(opts.configroot)
File "/usr/src/Zope-2.7.0/lib/python/Zope/Startup/__init__.py", line 51, in start_zope
starter.startZope()
File "/usr/src/Zope-2.7.0/lib/python/Zope/Startup/__init__.py", line 230, in startZope
Zope.startup()
File "/usr/src/Zope-2.7.0/lib/python/Zope/__init__.py", line 46, in startup
_startup()
File "/usr/src/Zope-2.7.0/lib/python/Zope/App/startup.py", line 45, in startup
OFS.Application.import_products()
File "/usr/src/Zope-2.7.0/lib/python/OFS/Application.py", line 631, in import_products
import_product(product_dir, product_name, raise_exc=debug_mode)
File "/usr/src/Zope-2.7.0/lib/python/OFS/Application.py", line 654, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/usr/src/Zope-2.7.0/Products/ZModelizationTool/__init__.py", line 28, in ?
import ZModelizationTool
File "/usr/src/Zope-2.7.0/Products/ZModelizationTool/ZModelizationTool.py", line 40, in ?
from Modeling.Entity import Entity
File "/usr/lib/python2.3/site-packages/Modeling/Entity.py", line 121, in ?
class Entity(base_object, XMLCapability, Persistent, KeyValueCoding):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Sebastien Bigaret
2004-02-22 10:14:02 UTC
Permalink
Post by W.J. MacIsaac
I've gone wrong somewhere, but I'm at a loss as to say how. Can anyone
diagnose this?
Zope runs fine without trying to import the tool.
Thanks,
Jeff
[...]
Post by W.J. MacIsaac
File "/usr/src/Zope-2.7.0/lib/python/OFS/Application.py", line 654, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "/usr/src/Zope-2.7.0/Products/ZModelizationTool/__init__.py", line 28, in ?
import ZModelizationTool
File "/usr/src/Zope-2.7.0/Products/ZModelizationTool/ZModelizationTool.py", line 40, in ?
from Modeling.Entity import Entity
File "/usr/lib/python2.3/site-packages/Modeling/Entity.py", line 121, in ?
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
My apologies for that, the responsability is defintiely on my side.

Quick fix: edit Entity.py and change the line that says:
----
class Entity(base_object, XMLCapability, Persistent, KeyValueCoding):
----
into:
----
class Entity(XMLCapability, Persistent, KeyValueCoding):
----

ie: remove 'base_object' from the list of its superclass.


Explanation: the patch for dynamic creation of modules from models which
is included in 0.9pre17 also included some changes in the base classes
of classes that are heavily used in the framework (among which:
Entity), making them subclasses of 'object'. This is because new-style
classes tends to run quicker then classic-styles. However, when ZODB
is installed (and this is definitely the case in the ZModeler scope!),
we get the "TypeError: metaclass conflict" exception for classes
inheriting from both types.ObjectType and ZODB.Persistent (extension
class).


I should have detected this but forgot to run the tests with ZODB
installed. This is now integrated into the shell script verifying
releases' integrity, hopefully this won't happen anymore.


Ticket #902106 has been created accordingly on sf.net. I'll try to
make a new release ASAP, since this will affect every installation
where ZODB is in the pythonpath (that's NOT a zope-only issue).

Thanks for reporting!

-- Sébastien.

Loading...