diff src/tools/misc.py @ 1367:f71a0fc26886

merged branch frontends_multi_profiles
author Goffi <goffi@goffi.org>
date Wed, 18 Mar 2015 10:52:28 +0100
parents ba41a81d14c2
children
line wrap: on
line diff
--- a/src/tools/misc.py	Thu Feb 05 11:59:26 2015 +0100
+++ b/src/tools/misc.py	Wed Mar 18 10:52:28 2015 +0100
@@ -20,7 +20,6 @@
 """Misc usefull classes"""
 
 from sat.core.i18n import _
-import sys
 from sat.core.log import getLogger
 log = getLogger(__name__)
 
@@ -39,8 +38,13 @@
     """This class manage triggers: code which interact to change the behaviour
     of SàT"""
 
-    MIN_PRIORITY = float('-inf')
-    MAX_PRIORITY = float('+inf')
+    try:  # FIXME: to be removed when a better solution is found
+        MIN_PRIORITY = float('-inf')
+        MAX_PRIORITY = float('+inf')
+    except:  # XXX: Pyjamas will bug if you specify ValueError here
+        # Pyjamas uses the JS Float class
+        MIN_PRIORITY = Number.NEGATIVE_INFINITY
+        MAX_PRIORITY = Number.POSITIVE_INFINITY
 
     def __init__(self):
         self.__triggers = {}
@@ -81,7 +85,7 @@
         if point_name not in self.__triggers:
             return True
 
-        for priority,trigger in self.__triggers[point_name]:
+        for priority, trigger in self.__triggers[point_name]:
             try:
                 if not trigger(*args, **kwargs):
                     return False