Skip to content

Commit

Permalink
LDIFParser now also accepts value-spec without a space after the colon
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Sep 30, 2015
1 parent b994312 commit c74ad89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 $
8 changes: 4 additions & 4 deletions Lib/ldif.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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+.
Expand Down Expand Up @@ -324,7 +324,7 @@ def _next_key_and_value(self):
# 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:])
Expand All @@ -336,8 +336,8 @@ def _next_key_and_value(self):
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):
Expand Down

0 comments on commit c74ad89

Please sign in to comment.