Skip to content

Commit

Permalink
Add support for X-ORIGIN in schema element class ObjectClass
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Pichugin committed Oct 8, 2018
1 parent ec41070 commit 7c22697
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Lib/ldap/schema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class ObjectClass(SchemaElement):
'AUXILIARY':None,
'ABSTRACT':None,
'MUST':(()),
'MAY':()
'MAY':(),
'X-ORIGIN':(None,)
}

def _set_attrs(self,l,d):
Expand All @@ -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:
Expand All @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion Tests/t_ldap_schema_subentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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' )"
)


Expand Down

0 comments on commit 7c22697

Please sign in to comment.