LDIFParser now also accepts value-spec without a space after the colon

This commit is contained in:
stroeder
2015-09-30 17:17:28 +00:00
parent b994312f31
commit c74ad89845
2 changed files with 7 additions and 5 deletions

View File

@@ -4,6 +4,8 @@ Released 2.4.22 2015-10-xx
Changes since 2.4.21:
Lib/
* LDIFParser now also accepts value-spec without a space
after the colon.
----------------------------------------------------------------
Released 2.4.21 2015-09-25
@@ -1202,4 +1204,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19
$Id: CHANGES,v 1.357 2015/09/30 17:15:53 stroeder Exp $
$Id: CHANGES,v 1.358 2015/09/30 17:17:28 stroeder Exp $

View File

@@ -3,7 +3,7 @@ ldif - generate and parse LDIF data (see RFC 2849)
See http://www.python-ldap.org/ for details.
$Id: ldif.py,v 1.84 2015/09/30 17:15:53 stroeder Exp $
$Id: ldif.py,v 1.85 2015/09/30 17:17:28 stroeder Exp $
Python compability note:
Tested with Python 2.0+, but should work with Python 1.5.2+.
@@ -324,7 +324,7 @@ class LDIFParser:
# if needed attribute value is BASE64 decoded
value_spec = unfolded_line[colon_pos:colon_pos+2]
if value_spec==': ':
attr_value = unfolded_line[colon_pos+2:]
attr_value = unfolded_line[colon_pos+2:].lstrip()
elif value_spec=='::':
# attribute value needs base64-decoding
attr_value = base64.decodestring(unfolded_line[colon_pos+2:])
@@ -336,8 +336,8 @@ class LDIFParser:
u = urlparse.urlparse(url)
if self._process_url_schemes.has_key(u[0]):
attr_value = urllib.urlopen(url).read()
elif value_spec==':\r\n' or value_spec=='\n':
attr_value = ''
else:
attr_value = unfolded_line[colon_pos+1:]
return attr_type,attr_value
def parse_entry_records(self):