]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Renamed `types` as it clashes with std lib
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 26 Mar 2018 15:16:16 +0000 (17:16 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Mon, 26 Mar 2018 15:16:16 +0000 (17:16 +0200)
This will lead to a name clash, when importing `types`

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/dashboard/tools.py

index 718eec4334e5cdcafbd2a2cb71667ecee586580f..ad81033eda18b731c7e08fc5b9c2609d62dbda69 100644 (file)
@@ -468,27 +468,27 @@ class NotificationQueue(threading.Thread):
         logger.debug("notification queue stopped")
 
     @classmethod
-    def register(cls, func, types=None):
+    def register(cls, func, n_types=None):
         """Registers function to listen for notifications
 
-        If the second parameter `types` is omitted, the function in `func`
+        If the second parameter `n_types` is omitted, the function in `func`
         parameter will be called for any type of notifications.
 
         Args:
             func (function): python function ex: def foo(val)
-            types (str|list): the single type to listen, or a list of types
+            n_types (str|list): the single type to listen, or a list of notification types
         """
         with cls._lock:
-            if not types:
+            if not n_types:
                 cls._listeners[cls._ALL_TYPES_].add(func)
                 return
-            if isinstance(types, str):
-                cls._listeners[types].add(func)
-            elif isinstance(types, list):
-                for typ in types:
+            if isinstance(n_types, str):
+                cls._listeners[n_types].add(func)
+            elif isinstance(n_types, list):
+                for typ in n_types:
                     cls._listeners[typ].add(func)
             else:
-                raise Exception("types param is neither a string nor a list")
+                raise Exception("n_types param is neither a string nor a list")
 
     @classmethod
     def new_notification(cls, notify_type, notify_value):