There are a mixture of methods called either 'lookup' or 'find'.
This dates back to when they raised LookupError, but these now raise NotFound.
They should be all called 'find' for consistency.
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
:param name: Either the DN or name of authentication policy
"""
try:
- return AuthenticationPolicy.lookup(ldb, name)
+ return AuthenticationPolicy.find(ldb, name)
except (ModelError, ValueError) as e:
raise CommandError(e)
:param name: Either the DN or name of authentication policy
"""
try:
- return AuthenticationPolicy.lookup(ldb, name)
+ return AuthenticationPolicy.find(ldb, name)
except (ModelError, ValueError) as e:
raise CommandError(e)
# Lookup attribute and class names in schema.
try:
- applies_to = [ClassSchema.lookup(ldb, name) for name in class_names]
- attribute = AttributeSchema.lookup(ldb, attribute_name)
- value_type = ValueType.lookup(ldb, attribute)
+ applies_to = [ClassSchema.find(ldb, name) for name in class_names]
+ attribute = AttributeSchema.find(ldb, attribute_name)
+ value_type = ValueType.find(ldb, attribute)
except (ModelError, ValueError) as e:
raise CommandError(e)
# Change class names for claim type.
if class_names is not None:
try:
- applies_to = [ClassSchema.lookup(ldb, name)
- for name in class_names]
+ applies_to = [ClassSchema.find(ldb, name) for name in class_names]
except (ModelError, ValueError) as e:
raise CommandError(e)
return "msDS-AuthNPolicy"
@staticmethod
- def lookup(ldb, name):
+ def find(ldb, name):
"""Helper function to return auth policy or raise NotFound.
:param ldb: Ldb connection
return "classSchema"
@classmethod
- def lookup(cls, ldb, name):
- """Helper function to lookup class or raise NotFound.
+ def find(cls, ldb, name):
+ """Helper function to find class by name or raise NotFound.
:param ldb: Ldb connection
:param name: Class name
return "attributeSchema"
@classmethod
- def lookup(cls, ldb, name):
- """Helper function to lookup attribute or raise NotFound.
+ def find(cls, ldb, name):
+ """Helper function to find attribute by name or raise NotFound.
:param ldb: Ldb connection
:param name: Attribute name
return "msDS-ValueType"
@classmethod
- def lookup(cls, ldb, attribute):
+ def find(cls, ldb, attribute):
"""Helper function to get ValueType by attribute or raise NotFound.
:param ldb: Ldb connection
raise NotFound(f"Could not find claim value type for {attribute}.")
return value_type
-
- def __str__(self):
- return str(self.display_name)