Abandoned old syntax when raising exceptions in module ldapurl and more information in some exceptions.
This commit is contained in:
		
							
								
								
									
										6
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -7,8 +7,8 @@ Changes since 2.4.19: | |||||||
|   to intercept the SASL handshake (thanks to René Kijewski) |   to intercept the SASL handshake (thanks to René Kijewski) | ||||||
|  |  | ||||||
| Lib/ | Lib/ | ||||||
| * Abandoned old syntax when raising ValueError in module ldif and | * Abandoned old syntax when raising ValueError in modules ldif and | ||||||
|   more information in some exceptions. |   ldapurl, more information in some exceptions. | ||||||
|  |  | ||||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ||||||
| Released 2.4.19 2015-01-10 | Released 2.4.19 2015-01-10 | ||||||
| @@ -1156,4 +1156,4 @@ Released 2.0.0pre02 2002-02-01 | |||||||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ||||||
| Released 1.10alpha3 2000-09-19 | 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 $ | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516 | |||||||
|  |  | ||||||
| See http://www.python-ldap.org/ for details. | 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: | Python compability note: | ||||||
| This module only works with Python 2.0+ since | This module only works with Python 2.0+ since | ||||||
| @@ -258,11 +258,11 @@ class LDAPUrl: | |||||||
|     urlscheme,host,dn,attrs,scope,filterstr,extensions |     urlscheme,host,dn,attrs,scope,filterstr,extensions | ||||||
|     """ |     """ | ||||||
|     if not isLDAPUrl(ldap_url): |     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) |     scheme,rest = ldap_url.split('://',1) | ||||||
|     self.urlscheme = scheme.strip() |     self.urlscheme = scheme.strip() | ||||||
|     if not self.urlscheme in ['ldap','ldaps','ldapi']: |     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('/') |     slash_pos = rest.find('/') | ||||||
|     qemark_pos = rest.find('?') |     qemark_pos = rest.find('?') | ||||||
|     if (slash_pos==-1) and (qemark_pos==-1): |     if (slash_pos==-1) and (qemark_pos==-1): | ||||||
| @@ -282,7 +282,7 @@ class LDAPUrl: | |||||||
|         # Do not eat question mark |         # Do not eat question mark | ||||||
|         rest = rest[qemark_pos:] |         rest = rest[qemark_pos:] | ||||||
|       else: |       else: | ||||||
|         raise ValueError,'Something completely weird happened!' |         raise ValueError('Something completely weird happened!') | ||||||
|     paramlist=rest.split('?',4) |     paramlist=rest.split('?',4) | ||||||
|     paramlist_len = len(paramlist) |     paramlist_len = len(paramlist) | ||||||
|     if paramlist_len>=1: |     if paramlist_len>=1: | ||||||
| @@ -294,7 +294,7 @@ class LDAPUrl: | |||||||
|       try: |       try: | ||||||
|         self.scope = SEARCH_SCOPE[scope] |         self.scope = SEARCH_SCOPE[scope] | ||||||
|       except KeyError: |       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: |     if paramlist_len>=4: | ||||||
|       filterstr = paramlist[3].strip() |       filterstr = paramlist[3].strip() | ||||||
|       if not filterstr: |       if not filterstr: | ||||||
| @@ -404,9 +404,9 @@ class LDAPUrl: | |||||||
|       else: |       else: | ||||||
|         return None |         return None | ||||||
|     else: |     else: | ||||||
|       raise AttributeError,"%s has no attribute %s" % ( |       raise AttributeError('%s has no attribute %s' % ( | ||||||
|         self.__class__.__name__,name |         self.__class__.__name__,name | ||||||
|       ) |       )) | ||||||
|     return result # __getattr__() |     return result # __getattr__() | ||||||
|  |  | ||||||
|   def __setattr__(self,name,value): |   def __setattr__(self,name,value): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 stroeder
					stroeder