Edgewall Software

Ticket #3162: foo

File foo, 1.1 KB (added by remco <remco.wouts@…>, 3 years ago)

Notify.py example to get LDAP support

Line 
1*** Notify.py   Wed May 17 14:06:16 2006
2--- Notify.py.bak       Wed May 17 17:30:18 2006
3***************
4*** 23,29 ****
5  import md5
6  import time
7  import smtplib
8! import ldap
9 
10  class Notify:
11      """Generic notification class for Trac. Subclass this to implement
12--- 23,29 ----
13  import md5
14  import time
15  import smtplib
16!
17 
18  class Notify:
19      """Generic notification class for Trac. Subclass this to implement
20***************
21*** 305,318 ****
22                  emails.append(recipient)
23              elif self.email_map.has_key(recipient):
24                  emails.append(self.email_map[recipient])
25-             else:
26-                 l = ldap.open("ldap1")
27-                 l.protocol_version = ldap.VERSION3
28-                 baseDN = "ou=people,dc=mpibp-frankfurt,dc=mpg,dc=de"
29-                 email = l.result(l.search(baseDN, ldap.SCOPE_SUBTREE,
30-                                           "uid="+recipient, ['mail']))[1][0][1]['mail'][0]
31-                 emails.append(email)
32-                 
33 
34          # Remove duplicates
35          result = []
36--- 305,310 ----