Skip to content

Commit 65e9271

Browse files
author
stroeder
committed
* 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
1 parent 072f5cf commit 65e9271

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

CHANGES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ Lib/
2020
without cleaning any data
2121
* Compability changes for pyasn1 0.3.x or newer
2222
(thanks to Ilya Etingof and Christian Heimes)
23+
* The methods SSSResponseControl.decodeControlValue() and
24+
VLVResponseControl.decodeControlValue() now follow the coding
25+
convention to use camel-cased ASN.1 name as class attribute name.
26+
The old class names are still set for back-ward compability
27+
but should not be used in new code because they might be removed
28+
in a later release.
29+
* removed SSSRequestControl from ldap.controls.KNOWN_RESPONSE_CONTROLS
2330

2431
Tests/
2532
* added explicit reconnect tests for ReconnectLDAPObject

Lib/ldap/controls/sss.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,17 @@ def __init__(self,criticality=False):
119119
def decodeControlValue(self, encoded):
120120
p, rest = decoder.decode(encoded, asn1Spec=SortResultType())
121121
assert not rest, 'all data could not be decoded'
122-
self.result = int(p.getComponentByName('sortResult'))
123-
self.result_code = p.getComponentByName('sortResult').prettyOut(self.result)
124-
attribute_type_error = p.getComponentByName('attributeType')
125-
if attribute_type_error.hasValue():
126-
self.attribute_type_error = attribute_type_error
122+
sort_result = p.getComponentByName('sortResult')
123+
self.sortResult = int(sort_result)
124+
attribute_type = p.getComponentByName('attributeType')
125+
if attribute_type.hasValue():
126+
self.attributeType = attribute_type
127127
else:
128-
self.attribute_type_error = None
128+
self.attributeType = None
129+
# backward compability class attributes
130+
self.result = self.sortResult
131+
self.attribute_type_error = self.attributeType
132+
# not sure whether to keep this
133+
self.result_code = sort_result.prettyPrint()
129134

130-
131-
KNOWN_RESPONSE_CONTROLS[SSSRequestControl.controlType] = SSSRequestControl
132135
KNOWN_RESPONSE_CONTROLS[SSSResponseControl.controlType] = SSSResponseControl

Lib/ldap/controls/vlv.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,21 @@ def __init__(self,criticality=False):
125125
def decodeControlValue(self,encoded):
126126
p, rest = decoder.decode(encoded, asn1Spec=VirtualListViewResponseType())
127127
assert not rest, 'all data could not be decoded'
128-
self.target_position = int(p.getComponentByName('targetPosition'))
129-
self.content_count = int(p.getComponentByName('contentCount'))
130-
self.result = int(p.getComponentByName('virtualListViewResult'))
131-
self.result_code = p.getComponentByName('virtualListViewResult').prettyOut(self.result)
128+
self.targetPosition = int(p.getComponentByName('targetPosition'))
129+
self.contentCount = int(p.getComponentByName('contentCount'))
130+
virtual_list_view_result = p.getComponentByName('virtualListViewResult')
131+
self.virtualListViewResult = int(virtual_list_view_result)
132132
context_id = p.getComponentByName('contextID')
133133
if context_id.hasValue():
134-
self.context_id = str(context_id)
134+
self.contextID = str(context_id)
135135
else:
136-
self.context_id = None
137-
136+
self.contextID = None
137+
# backward compability class attributes
138+
self.target_position = self.targetPosition
139+
self.content_count = self.contentCount
140+
self.result = self.virtualListViewResult
141+
self.context_id = self.contextID
142+
# not sure whether to keep this
143+
self.result_code = virtual_list_view_result.prettyPrint()
138144

139145
KNOWN_RESPONSE_CONTROLS[VLVResponseControl.controlType] = VLVResponseControl

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy