Commit dba31739 authored by Nicolas Delaby's avatar Nicolas Delaby

Replace String Exception by Exception instances

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30537 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6d2cb41f
# -*- coding: utf-8 -*-
# core of LDAP Filter Methods. # core of LDAP Filter Methods.
...@@ -180,6 +181,9 @@ _ldapScopes = { "ONELEVEL": ldap.SCOPE_ONELEVEL, ...@@ -180,6 +181,9 @@ _ldapScopes = { "ONELEVEL": ldap.SCOPE_ONELEVEL,
"SUBTREE": ldap.SCOPE_SUBTREE, "SUBTREE": ldap.SCOPE_SUBTREE,
"BASE": ldap.SCOPE_BASE } "BASE": ldap.SCOPE_BASE }
class LDAPError(Exception):
pass
class LDAPMethod(Aqueduct.BaseQuery, class LDAPMethod(Aqueduct.BaseQuery,
Acquisition.Implicit, Acquisition.Implicit,
Globals.Persistent, Globals.Persistent,
...@@ -319,7 +323,7 @@ class LDAPMethod(Aqueduct.BaseQuery, ...@@ -319,7 +323,7 @@ class LDAPMethod(Aqueduct.BaseQuery,
else: REQUEST={} else: REQUEST={}
c = self._getConn() c = self._getConn()
if not c: if not c:
raise "LDAPError", "LDAP Connection not open" raise LDAPError('LDAP Connection not open')
if getattr(self, 'aq_parent', None) is not None: if getattr(self, 'aq_parent', None) is not None:
p = self.aq_parent p = self.aq_parent
...@@ -452,7 +456,7 @@ class LDIFMethod(LDAPMethod): ...@@ -452,7 +456,7 @@ class LDIFMethod(LDAPMethod):
else: REQUEST={} else: REQUEST={}
c = self._connection().GetConnection() c = self._connection().GetConnection()
if not c: if not c:
raise "LDAPError", "LDAP Connection not open" raise LDAPError('LDAP Connection not open')
if hasattr(self, 'aq_parent'): if hasattr(self, 'aq_parent'):
p = self.aq_parent p = self.aq_parent
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment