bt2: add bt2._OutputPort.create_notification_iterator()
[babeltrace.git] / bindings / python / bt2 / bt2 / connection.py
index fdeb84d97669502df52d41e2d9f296af40f4484b..289667f5ba07d05ba3e315ca102fec93929baf63 100644 (file)
@@ -82,17 +82,9 @@ class _Connection(object._Object):
 
 class _PrivateConnection(object._PrivateObject, _Connection):
     def create_notification_iterator(self, notification_types=None):
-        if notification_types is None:
-            notif_types = None
-        else:
-            for notif_cls in notification_types:
-                if notif_cls not in bt2.notification._NOTIF_TYPE_TO_CLS.values():
-                    raise ValueError("'{}' is not a notification class".format(notif_cls))
-
-            notif_types = [notif_cls._TYPE for notif_cls in notification_types]
-
-        status, notif_iter_ptr = native_bt.py3_create_notif_iter(int(self._ptr),
-                                                                notif_types)
+        notif_types = bt2.notification._notif_types_from_notif_classes(notification_types)
+        status, notif_iter_ptr = native_bt.py3_create_priv_conn_notif_iter(int(self._ptr),
+                                                                           notif_types)
         _handle_status(status, 'cannot create notification iterator object')
         assert(notif_iter_ptr)
         return bt2.notification_iterator._PrivateConnectionNotificationIterator._create_from_ptr(notif_iter_ptr)
This page took 0.022794 seconds and 4 git commands to generate.