File: __init__.py

package info (click to toggle)
python-ldap 1.9.999.pre04-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 312 kB
  • ctags: 475
  • sloc: ansic: 2,973; python: 1,141; makefile: 84; sh: 4
file content (37 lines) | stat: -rw-r--r-- 755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# $Id: __init__.py,v 1.7 2002/02/02 11:15:49 stroeder Exp $

__version__ = '2.0.0pre04'

from _ldap import *

try:

  # Check if Python installation was build with thread support
  import threading

except ImportError:

  def _ldap_call(func,*args,**kwargs):
    """
    Wrapper function if threading module is not available
    """
    return apply(func,args,kwargs)

else:

  # Global lock for serializing all calls into underlying LDAP lib
  _ldap_lock = threading.Lock()

  def _ldap_call(func,*args,**kwargs):
    """
    Wrapper function which locks calls to func with via _ldap_lock
    """
    _ldap_lock.acquire()
    try:
      result = apply(func,args,kwargs)
    finally:
      _ldap_lock.release()
    return result


from functions import *