Add method to filter devices
This commit is contained in:
parent
82378e0bd7
commit
405f71f621
@ -147,6 +147,20 @@ class OMMClient2:
|
||||
d = self.get_device(ppn)
|
||||
return self.detach_user_device(d.uid, ppn)
|
||||
|
||||
def find_devices(self, filter):
|
||||
"""
|
||||
Get all devices matching a filter
|
||||
|
||||
:param filter: function taking one parameter which is a device, returns True to keep, False to discard
|
||||
|
||||
Usage::
|
||||
|
||||
>>> c.find_devices(lambda d: d.relType == mitel_ommclient2.types.PPRelTypeType("Unbound"))
|
||||
"""
|
||||
|
||||
for d in self.get_devices():
|
||||
if filter(d):
|
||||
yield d
|
||||
|
||||
def get_account(self, id):
|
||||
"""
|
||||
|
@ -72,6 +72,9 @@ class EnumType:
|
||||
def __repr__(self):
|
||||
return "{}({})".format(self.__class__.__name__, repr(self.value))
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, type(self)) and self.value == other.value
|
||||
|
||||
|
||||
class CallForwardStateType(EnumType):
|
||||
VALUES = [
|
||||
|
Loading…
Reference in New Issue
Block a user