Browse Source

Modified singleton sessionHandler: from __new__ to __init__ checked

m.orban 8 years ago
parent
commit
9ae7855c50
2 changed files with 6 additions and 7 deletions
  1. 5
    6
      lodel/plugin/plugins.py
  2. 1
    1
      lodel/settings/validator.py

+ 5
- 6
lodel/plugin/plugins.py View File

@@ -795,14 +795,13 @@ with %s" % (custom_method._method_name, custom_method))
795 795
 
796 796
 class SessionHandler(Plugin):
797 797
     __instance = None
798
-
799
-    def __new__(cls):
800
-        if cls.__instance == None:
801
-            cls.instance == object.__new__(cls)
802
-        return cls.__instance
803 798
         
804 799
     def __init__(self, plugin_name):
805
-        super(Plugin, self).__init__(plugin_name)
800
+        if self.__instance is None:
801
+            super(Plugin, self).__init__(plugin_name)
802
+            self.__instance = True
803
+        else:
804
+            raise RuntimeError("A SessionHandler Plugin is already plug")
806 805
 
807 806
 class InterfacePlugin(Plugin):
808 807
     def __init__(self, plugin_name):

+ 1
- 1
lodel/settings/validator.py View File

@@ -240,7 +240,7 @@ def emfield_val(value):
240 240
     return value
241 241
 
242 242
 def plugin_val(value):
243
-    if spl = value.split('.')
243
+    spl = value.split('.')
244 244
     if len(spl) != 2:
245 245
         msg = "Expected a value in the form PLUGIN.TYPE but got : %s"
246 246
         raise SettingsValidationError(msg % value)

Loading…
Cancel
Save