From 7c22697600c3f49b03d393be54d9b2db81cf56c0 Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Mon, 8 Oct 2018 18:03:59 +0200 Subject: [PATCH] Add support for X-ORIGIN in schema element class ObjectClass --- Lib/ldap/schema/models.py | 5 ++++- Tests/t_ldap_schema_subentry.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/ldap/schema/models.py b/Lib/ldap/schema/models.py index feb7bff..22ba6fb 100644 --- a/Lib/ldap/schema/models.py +++ b/Lib/ldap/schema/models.py @@ -137,7 +137,8 @@ class ObjectClass(SchemaElement): 'AUXILIARY':None, 'ABSTRACT':None, 'MUST':(()), - 'MAY':() + 'MAY':(), + 'X-ORIGIN':(None,) } def _set_attrs(self,l,d): @@ -146,6 +147,7 @@ def _set_attrs(self,l,d): self.desc = d['DESC'][0] self.must = d['MUST'] self.may = d['MAY'] + self.x_origin = d['X-ORIGIN'][0] # Default is STRUCTURAL, see RFC2552 or draft-ietf-ldapbis-syntaxes self.kind = 0 if d['ABSTRACT']!=None: @@ -168,6 +170,7 @@ def __str__(self): result.append({0:' STRUCTURAL',1:' ABSTRACT',2:' AUXILIARY'}[self.kind]) result.append(self.key_list('MUST',self.must,sep=' $ ')) result.append(self.key_list('MAY',self.may,sep=' $ ')) + result.append(self.key_attr('X-ORIGIN',self.x_origin,quoted=1)) return '( %s )' % ''.join(result) diff --git a/Tests/t_ldap_schema_subentry.py b/Tests/t_ldap_schema_subentry.py index 4e1e09b..5869b9d 100644 --- a/Tests/t_ldap_schema_subentry.py +++ b/Tests/t_ldap_schema_subentry.py @@ -61,7 +61,7 @@ def test_urlfetch_file(self): str(obj), "( 2.5.6.9 NAME 'groupOfNames' SUP top STRUCTURAL MUST cn " "MAY ( member $ businessCategory $ seeAlso $ owner $ ou $ o " - "$ description ) )" + "$ description ) X-ORIGIN 'RFC 4519' )" )