sebastien - in flumotion/trunk: . flumotion/common

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Thu May 10 19:07:44 CEST 2007


Author: sebastien
Date: Thu May 10 19:07:42 2007
New Revision: 4932

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/common/enum.py
Log:
2007-05-10  Sebastien Merle  <sebastien at fluendo.com>

	* flumotion/common/enum.py: 
	Corrected a bug when creating a generic enum instance.


Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Thu May 10 19:07:42 2007
@@ -1,3 +1,8 @@
+2007-05-10  Sebastien Merle  <sebastien at fluendo.com>
+
+	* flumotion/common/enum.py: 
+	Corrected a bug when creating a generic enum instance.
+
 2007-05-10  Zaheer Abbas Merali  <<zaheerabbas at merali dot org>>
 
 	* flumotion/component/combiners/switch/switch.py (Switch, SingleSwitch,

Modified: flumotion/trunk/flumotion/common/enum.py
==============================================================================
--- flumotion/trunk/flumotion/common/enum.py	(original)
+++ flumotion/trunk/flumotion/common/enum.py	Thu May 10 19:07:42 2007
@@ -47,6 +47,7 @@
 
 
 class Enum(object, jelly.Jellyable):
+    
     __metaclass__ = EnumMetaClass
     def __init__(self, value, name, nick=None):
         self.value = value
@@ -117,16 +118,14 @@
         enumClassName, value, name, nick = jellyList[1:]
         enumClass = _enumClassRegistry.get(enumClassName, None)
         if enumClass:
+            # Retrieve the enum singleton
             enum = enumClass.get(value)
             assert enum.name == name, "Inconsistent Enum Name"
-            return enum
-        # Become a generic Enum instance
-        self.__class__ = Enum
-        self._enumClassName = enumClassName
-        self.value = value
-        self.name = name
-        self.nick = nick
-        return self
+        else:
+            # Create a generic Enum container
+            enum = Enum(value, name, nick)
+            enum._enumClassName = enumClassName
+        return enum
 
 
 jelly.setUnjellyableForClass(qual(Enum), EnumUnjellyer)


More information about the flumotion-commit mailing list