Skip to content
Snippets Groups Projects
Commit dcc3c529 authored by Julian Rother's avatar Julian Rother
Browse files

Added Subschema.extend method

parent 2aab1cab
No related branches found
No related tags found
No related merge requests found
Pipeline #7980 failed
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
...@@ -583,6 +583,20 @@ class Subschema(Object): ...@@ -583,6 +583,20 @@ class Subschema(Object):
self['matchingRules'] = [matching_rule.encode_syntax_definition() for matching_rule in self.matching_rules.values()] self['matchingRules'] = [matching_rule.encode_syntax_definition() for matching_rule in self.matching_rules.values()]
self['attributeTypes'] = [attribute_type.schema_encoding for attribute_type in self.attribute_types.values()] self['attributeTypes'] = [attribute_type.schema_encoding for attribute_type in self.attribute_types.values()]
def extend(self, *subschemas, dn=None, object_classes=None, attribute_types=None, matching_rules=None, syntaxes=None):
if dn is None:
dn = self.dn
object_classes = list(self.object_classes.values()) + list(object_classes or [])
attribute_types = list(self.attribute_types.values()) + list(attribute_types or [])
matching_rules = list(self.matching_rules.values()) + list(matching_rules or [])
syntaxes = list(self.syntaxes.values()) + list(syntaxes or [])
for subschema in subschemas:
object_classes += list(subschema.object_classes.values())
attribute_types += list(subschema.attribute_types.values())
matching_rules += list(subschema.matching_rules.values())
syntaxes += list(subschema.syntaxes.values())
return Subschema(dn, object_classes, attribute_types, matching_rules, syntaxes)
def lookup_attribute(self, oid_or_name, fail_if_not_found=False): def lookup_attribute(self, oid_or_name, fail_if_not_found=False):
if isinstance(oid_or_name, AttributeType): if isinstance(oid_or_name, AttributeType):
if self.attribute_types.get(oid_or_name.oid) != oid_or_name: if self.attribute_types.get(oid_or_name.oid) != oid_or_name:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment