Commit 3ca8cc63 authored by Nicolas Delaby's avatar Nicolas Delaby

Display LDIF Query when commit fails, make basedn available in dtml template

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19363 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f458363d
...@@ -22,7 +22,7 @@ import DocumentTemplate ...@@ -22,7 +22,7 @@ import DocumentTemplate
import ExtensionClass import ExtensionClass
import sys import sys
from zLOG import LOG from zLOG import LOG, INFO
from ldif import LDIFRecordList, is_dn, valid_changetype_dict, CHANGE_TYPES from ldif import LDIFRecordList, is_dn, valid_changetype_dict, CHANGE_TYPES
import ldifvar import ldifvar
from AccessControl.DTML import RestrictedDTML from AccessControl.DTML import RestrictedDTML
...@@ -459,7 +459,7 @@ class LDIFMethod(LDAPMethod): ...@@ -459,7 +459,7 @@ class LDIFMethod(LDAPMethod):
else: p = None else: p = None
argdata = self._argdata(REQUEST) #use our BaseQuery's magic. :) argdata = self._argdata(REQUEST) #use our BaseQuery's magic. :)
argdata['basedn'] = self.basedn
# Also need the authenticated user. # Also need the authenticated user.
auth_user = REQUEST.get('AUTHENTICATED_USER', None) auth_user = REQUEST.get('AUTHENTICATED_USER', None)
if auth_user is None: if auth_user is None:
...@@ -502,12 +502,18 @@ class LDIFMethod(LDAPMethod): ...@@ -502,12 +502,18 @@ class LDIFMethod(LDAPMethod):
c.delete_s(dn) c.delete_s(dn)
except ldap.NO_SUCH_OBJECT: except ldap.NO_SUCH_OBJECT:
pass pass
except:
LOG('ldif', INFO, ldif)
raise
def add(c, dn, mod_list): def add(c, dn, mod_list):
try: try:
c.add_s(dn, mod_list) c.add_s(dn, mod_list)
except ldap.ALREADY_EXISTS: except ldap.ALREADY_EXISTS:
pass pass
except:
LOG('ldif', INFO, ldif)
raise
for record in res: for record in res:
dn = record[0] dn = record[0]
...@@ -534,7 +540,7 @@ class LDIFMethod(LDAPMethod): ...@@ -534,7 +540,7 @@ class LDIFMethod(LDAPMethod):
c = self._connection().getForcedConnection() c = self._connection().getForcedConnection()
add(c, dn, mod_list) add(c, dn, mod_list)
else: else:
LOG('LDIFMethod Type unknow',0,'') LOG('LDIFMethod Type unknow', INFO, '')
return res return res
......
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