Now use six.with_metaclass to create the Base type in a python 2/3 compatible way

This commit is contained in:
Christophe de Vienne 2012-10-06 21:18:05 +02:00
parent be16f84738
commit 7cad370657

View File

@ -517,13 +517,12 @@ class BaseMeta(type):
cls.__registry__.register(cls) cls.__registry__.register(cls)
def Base__init__(self, **kw): class Base(six.with_metaclass(BaseMeta)):
def __init__(self, **kw):
for key, value in kw.items(): for key, value in kw.items():
if hasattr(self, key): if hasattr(self, key):
setattr(self, key, value) setattr(self, key, value)
Base = BaseMeta('Base', (object, ), {'__init__': Base__init__})
class File(Base): class File(Base):
"""A complex type that represents a file. """A complex type that represents a file.