Commit cf37fdd3 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Call super class' __init__ method and hard define attributes.


git-svn-id: https://svn.erp5.org/repos/neo/trunk@1342 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 802aadb8
...@@ -103,6 +103,9 @@ class Enum(dict): ...@@ -103,6 +103,9 @@ class Enum(dict):
class Item(int): class Item(int):
_enum = None
_name = None
def __new__(cls, value): def __new__(cls, value):
instance = super(Enum.Item, cls).__new__(cls, value) instance = super(Enum.Item, cls).__new__(cls, value)
instance._enum = None instance._enum = None
...@@ -123,6 +126,7 @@ class Enum(dict): ...@@ -123,6 +126,7 @@ class Enum(dict):
return int(self) == int(other) return int(self) == int(other)
def __init__(self): def __init__(self):
dict.__init__(self)
for name in dir(self): for name in dir(self):
if not re.match('^[A-Z_]*$', name): if not re.match('^[A-Z_]*$', name):
continue continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment