diff --git a/CHANGES b/CHANGES index b64b782..e41032b 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,13 @@ Lib/ without cleaning any data * Compability changes for pyasn1 0.3.x or newer (thanks to Ilya Etingof and Christian Heimes) +* The methods SSSResponseControl.decodeControlValue() and + VLVResponseControl.decodeControlValue() now follow the coding + convention to use camel-cased ASN.1 name as class attribute name. + The old class names are still set for back-ward compability + but should not be used in new code because they might be removed + in a later release. +* removed SSSRequestControl from ldap.controls.KNOWN_RESPONSE_CONTROLS Tests/ * added explicit reconnect tests for ReconnectLDAPObject diff --git a/Lib/ldap/controls/sss.py b/Lib/ldap/controls/sss.py index 20697fa..7899f04 100644 --- a/Lib/ldap/controls/sss.py +++ b/Lib/ldap/controls/sss.py @@ -119,14 +119,17 @@ def __init__(self,criticality=False): def decodeControlValue(self, encoded): p, rest = decoder.decode(encoded, asn1Spec=SortResultType()) assert not rest, 'all data could not be decoded' - self.result = int(p.getComponentByName('sortResult')) - self.result_code = p.getComponentByName('sortResult').prettyOut(self.result) - attribute_type_error = p.getComponentByName('attributeType') - if attribute_type_error.hasValue(): - self.attribute_type_error = attribute_type_error + sort_result = p.getComponentByName('sortResult') + self.sortResult = int(sort_result) + attribute_type = p.getComponentByName('attributeType') + if attribute_type.hasValue(): + self.attributeType = attribute_type else: - self.attribute_type_error = None + self.attributeType = None + # backward compability class attributes + self.result = self.sortResult + self.attribute_type_error = self.attributeType + # not sure whether to keep this + self.result_code = sort_result.prettyPrint() - -KNOWN_RESPONSE_CONTROLS[SSSRequestControl.controlType] = SSSRequestControl KNOWN_RESPONSE_CONTROLS[SSSResponseControl.controlType] = SSSResponseControl diff --git a/Lib/ldap/controls/vlv.py b/Lib/ldap/controls/vlv.py index 980b77b..4b3d931 100644 --- a/Lib/ldap/controls/vlv.py +++ b/Lib/ldap/controls/vlv.py @@ -125,15 +125,21 @@ def __init__(self,criticality=False): def decodeControlValue(self,encoded): p, rest = decoder.decode(encoded, asn1Spec=VirtualListViewResponseType()) assert not rest, 'all data could not be decoded' - self.target_position = int(p.getComponentByName('targetPosition')) - self.content_count = int(p.getComponentByName('contentCount')) - self.result = int(p.getComponentByName('virtualListViewResult')) - self.result_code = p.getComponentByName('virtualListViewResult').prettyOut(self.result) + self.targetPosition = int(p.getComponentByName('targetPosition')) + self.contentCount = int(p.getComponentByName('contentCount')) + virtual_list_view_result = p.getComponentByName('virtualListViewResult') + self.virtualListViewResult = int(virtual_list_view_result) context_id = p.getComponentByName('contextID') if context_id.hasValue(): - self.context_id = str(context_id) + self.contextID = str(context_id) else: - self.context_id = None - + self.contextID = None + # backward compability class attributes + self.target_position = self.targetPosition + self.content_count = self.contentCount + self.result = self.virtualListViewResult + self.context_id = self.contextID + # not sure whether to keep this + self.result_code = virtual_list_view_result.prettyPrint() KNOWN_RESPONSE_CONTROLS[VLVResponseControl.controlType] = VLVResponseControl