[Zope-dev] can't register adapters for classes with metaclasses
Chris Withers
chris at simplistix.co.uk
Sun Feb 27 06:24:55 EST 2011
Hi All,
This is particularly problematic when using the common case of
SQLAlchemy declaratively mapped model classes.
The attached unit test when run will fail with:
Error in test test_provideAdapter (test_sa.TestAdapter)
Traceback (most recent call last):
File "/usr/local/lib/python2.6/unittest.py", line 279, in run
testMethod()
File "test_sa.py", line 25, in test_provideAdapter
provideAdapter(MyAdapter,Model)
File
"zope.component-3.10.0-py2.6.egg/zope/component/globalregistry.py", line
72, in provideAdapter
base.registerAdapter(factory, adapts, provides, name, event=False)
File "zope.component-3.10.0-py2.6.egg/zope/component/registry.py",
line 182, in registerAdapter
required = _getAdapterRequired(factory, required)
File "zope.component-3.10.0-py2.6.egg/zope/component/registry.py",
line 414, in _getAdapterRequired
for r in required:
TypeError: 'DeclarativeMeta' object is not iterable
Why is that and how should I register an adapter against such a class?
cheers,
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_sa.py
Url: http://mail.zope.org/pipermail/zope-dev/attachments/20110227/d7805e21/attachment.pl
More information about the Zope-Dev
mailing list