Skip to content

Commit

Permalink
Abandoned old syntax when raising exceptions in module ldapurl and mo…
Browse files Browse the repository at this point in the history
…re information in some exceptions.
  • Loading branch information
stroeder committed Jun 5, 2015
1 parent 92ca887 commit 62219a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Changes since 2.4.19:
to intercept the SASL handshake (thanks to René Kijewski)

Lib/
* Abandoned old syntax when raising ValueError in module ldif and
more information in some exceptions.
* Abandoned old syntax when raising ValueError in modules ldif and
ldapurl, more information in some exceptions.

----------------------------------------------------------------
Released 2.4.19 2015-01-10
Expand Down Expand Up @@ -1156,4 +1156,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19

$Id: CHANGES,v 1.341 2015/06/05 20:56:00 stroeder Exp $
$Id: CHANGES,v 1.342 2015/06/05 21:03:06 stroeder Exp $
14 changes: 7 additions & 7 deletions Lib/ldapurl.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: ldapurl.py,v 1.69 2015/01/10 17:18:13 stroeder Exp $
\$Id: ldapurl.py,v 1.70 2015/06/05 21:03:06 stroeder Exp $
Python compability note:
This module only works with Python 2.0+ since
Expand Down Expand Up @@ -258,11 +258,11 @@ def _parse(self,ldap_url):
urlscheme,host,dn,attrs,scope,filterstr,extensions
"""
if not isLDAPUrl(ldap_url):
raise ValueError,'Parameter ldap_url does not seem to be a LDAP URL.'
raise ValueError('Value %s for ldap_url does not seem to be a LDAP URL.' % (repr(ldap_url)))
scheme,rest = ldap_url.split('://',1)
self.urlscheme = scheme.strip()
if not self.urlscheme in ['ldap','ldaps','ldapi']:
raise ValueError,'LDAP URL contains unsupported URL scheme %s.' % (self.urlscheme)
raise ValueError('LDAP URL contains unsupported URL scheme %s.' % (self.urlscheme))
slash_pos = rest.find('/')
qemark_pos = rest.find('?')
if (slash_pos==-1) and (qemark_pos==-1):
Expand All @@ -282,7 +282,7 @@ def _parse(self,ldap_url):
# Do not eat question mark
rest = rest[qemark_pos:]
else:
raise ValueError,'Something completely weird happened!'
raise ValueError('Something completely weird happened!')
paramlist=rest.split('?',4)
paramlist_len = len(paramlist)
if paramlist_len>=1:
Expand All @@ -294,7 +294,7 @@ def _parse(self,ldap_url):
try:
self.scope = SEARCH_SCOPE[scope]
except KeyError:
raise ValueError,"Search scope must be either one of base, one or sub. LDAP URL contained %s" % (repr(scope))
raise ValueError('Invalid search scope %s' % (repr(scope)))
if paramlist_len>=4:
filterstr = paramlist[3].strip()
if not filterstr:
Expand Down Expand Up @@ -404,9 +404,9 @@ def __getattr__(self,name):
else:
return None
else:
raise AttributeError,"%s has no attribute %s" % (
raise AttributeError('%s has no attribute %s' % (
self.__class__.__name__,name
)
))
return result # __getattr__()

def __setattr__(self,name,value):
Expand Down

0 comments on commit 62219a2

Please sign in to comment.