-
Notifications
You must be signed in to change notification settings - Fork 127
Add support for X-ORIGIN in schema element class ObjectClass #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
7c22697
ebc12da
9f5a578
7d1359c
cd35f1c
c186345
2dc4ebd
7b76b00
9c48d3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -126,6 +126,9 @@ class ObjectClass(SchemaElement): | |||||
sup | ||||||
This list of strings contains NAMEs or OIDs of object classes | ||||||
this object class is derived from | ||||||
x-origin | ||||||
This string contains the X-ORIGIN text which is typically used to indicate | ||||||
the source of the associated schema element. It can a list of strings | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree. But it has a small typo - "be be" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, should we change other docstrings then for the consistency? For example, 'may' also should be a tuple but the docstring states 'This list of strings':
I can add one more commit here for this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess "sequence" is the exact thing we want here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, list wouldn't work because the SchemaElement class explicitly requires a 'tuple'. class SchemaElement:
def key_list(self,key,values,sep=' ',quoted=0):
assert type(values)==tuple,TypeError("values has to be a tuple, was %r" % values) |
||||||
""" | ||||||
schema_attribute = u'objectClasses' | ||||||
token_defaults = { | ||||||
|
@@ -137,7 +140,8 @@ class ObjectClass(SchemaElement): | |||||
'AUXILIARY':None, | ||||||
'ABSTRACT':None, | ||||||
'MUST':(()), | ||||||
'MAY':() | ||||||
'MAY':(), | ||||||
'X-ORIGIN':() | ||||||
} | ||||||
|
||||||
def _set_attrs(self,l,d): | ||||||
|
@@ -146,6 +150,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'] | ||||||
# Default is STRUCTURAL, see RFC2552 or draft-ietf-ldapbis-syntaxes | ||||||
self.kind = 0 | ||||||
if d['ABSTRACT']!=None: | ||||||
|
@@ -168,6 +173,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_list('X-ORIGIN',self.x_origin,quoted=1)) | ||||||
return '( %s )' % ''.join(result) | ||||||
|
||||||
|
||||||
|
@@ -224,6 +230,9 @@ class AttributeType(SchemaElement): | |||||
sup | ||||||
This list of strings contains NAMEs or OIDs of attribute types | ||||||
this attribute type is derived from | ||||||
x-origin | ||||||
This string contains the X-ORIGIN text which is typically used to indicate | ||||||
the source of the associated schema element. It can a list of strings | ||||||
""" | ||||||
schema_attribute = u'attributeTypes' | ||||||
token_defaults = { | ||||||
|
@@ -239,7 +248,7 @@ class AttributeType(SchemaElement): | |||||
'COLLECTIVE':None, | ||||||
'NO-USER-MODIFICATION':None, | ||||||
'USAGE':('userApplications',), | ||||||
'X-ORIGIN':(None,), | ||||||
'X-ORIGIN':(), | ||||||
'X-ORDERED':(None,), | ||||||
} | ||||||
|
||||||
|
@@ -251,7 +260,7 @@ def _set_attrs(self,l,d): | |||||
self.equality = d['EQUALITY'][0] | ||||||
self.ordering = d['ORDERING'][0] | ||||||
self.substr = d['SUBSTR'][0] | ||||||
self.x_origin = d['X-ORIGIN'][0] | ||||||
self.x_origin = d['X-ORIGIN'] | ||||||
self.x_ordered = d['X-ORDERED'][0] | ||||||
try: | ||||||
syntax = d['SYNTAX'][0] | ||||||
|
@@ -302,7 +311,7 @@ def __str__(self): | |||||
3:" USAGE dSAOperation", | ||||||
}[self.usage] | ||||||
) | ||||||
result.append(self.key_attr('X-ORIGIN',self.x_origin,quoted=1)) | ||||||
result.append(self.key_list('X-ORIGIN',self.x_origin,quoted=1)) | ||||||
result.append(self.key_attr('X-ORDERED',self.x_ordered,quoted=1)) | ||||||
return '( %s )' % ''.join(result) | ||||||
|
||||||
|
Uh oh!
There was an error while loading. Please reload this page.