diff options
| author | Jan Cholasta <jcholast@redhat.com> | 2015-08-26 13:29:18 +0200 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2015-09-07 08:00:11 +0200 |
| commit | ebdfa4380bdcdd99970c7d677df7e0d5e3ede6bc (patch) | |
| tree | b9d9193f90c69bac773ad0542254de7e3aa47902 | |
| parent | 198908ec78b9a2dbdb802c3a094ec8f54b931d7a (diff) | |
Use six.with_metaclass to specify metaclasses
Metaclass specification is incompatible between Python 2 and 3. Use the
six.with_metaclass helper to specify metaclasses.
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
| -rw-r--r-- | ipapython/install/core.py | 12 | ||||
| -rw-r--r-- | ipapython/install/util.py | 1 | ||||
| -rw-r--r-- | ipaserver/install/ipa_otptoken_import.py | 5 |
3 files changed, 7 insertions, 11 deletions
diff --git a/ipapython/install/core.py b/ipapython/install/core.py index f4b2806ea..45f7aef78 100644 --- a/ipapython/install/core.py +++ b/ipapython/install/core.py @@ -54,8 +54,7 @@ class KnobValueError(ValueError): self.name = name -class InnerClass(object): - __metaclass__ = util.InnerClassMeta +class InnerClass(six.with_metaclass(util.InnerClassMeta, object)): __outer_class__ = None __outer_name__ = None @@ -162,15 +161,13 @@ def Knob(type, default=_missing, initializable=_missing, sensitive=_missing, return util.InnerClassMeta('Knob', (KnobBase,), class_dict) -class Configurable(object): +class Configurable(six.with_metaclass(abc.ABCMeta, object)): """ Base class of all configurables. FIXME: details of validate/execute, properties and knobs """ - __metaclass__ = abc.ABCMeta - @classmethod def knobs(cls): """ @@ -382,9 +379,8 @@ class ComponentMeta(util.InnerClassMeta, abc.ABCMeta): pass -class ComponentBase(InnerClass, Configurable): - __metaclass__ = ComponentMeta - +class ComponentBase( + six.with_metaclass(ComponentMeta, InnerClass, Configurable)): _order = None @classmethod diff --git a/ipapython/install/util.py b/ipapython/install/util.py index d86db218b..1c264a858 100644 --- a/ipapython/install/util.py +++ b/ipapython/install/util.py @@ -159,5 +159,6 @@ class InnerClassMeta(type): self.__outer_class__ = cls self.__outer_name__ = name self.__name__ = '.'.join((cls.__name__, name)) + self.__qualname__ = self.__name__ return cls, name diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py index 98de4799d..130e2ce51 100644 --- a/ipaserver/install/ipa_otptoken_import.py +++ b/ipaserver/install/ipa_otptoken_import.py @@ -31,6 +31,7 @@ import dateutil.parser import dateutil.tz import nss.nss as nss import gssapi +import six from six.moves import xrange from ipapython import admintool @@ -147,10 +148,8 @@ def convertEncrypted(value, decryptor=None, pconv=base64.b64decode, econv=lambda return None -class XMLKeyDerivation(object): +class XMLKeyDerivation(six.with_metaclass(abc.ABCMeta, object)): "Interface for XML Encryption 1.1 key derivation." - __metaclass__ = abc.ABCMeta - @abc.abstractmethod def __init__(self, enckey): "Sets up key derivation parameters from the parent XML entity." |
