From 7cad370657f84f9a7c42b5656723861684b5cb98 Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Sat, 6 Oct 2012 21:18:05 +0200 Subject: [PATCH] Now use six.with_metaclass to create the Base type in a python 2/3 compatible way --- wsme/types.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wsme/types.py b/wsme/types.py index 61c8678..314fc59 100644 --- a/wsme/types.py +++ b/wsme/types.py @@ -517,12 +517,11 @@ class BaseMeta(type): cls.__registry__.register(cls) -def Base__init__(self, **kw): - for key, value in kw.items(): - if hasattr(self, key): - setattr(self, key, value) - -Base = BaseMeta('Base', (object, ), {'__init__': Base__init__}) +class Base(six.with_metaclass(BaseMeta)): + def __init__(self, **kw): + for key, value in kw.items(): + if hasattr(self, key): + setattr(self, key, value) class File(Base):