File: pickle_ldapobject.py

package info (click to toggle)
python-ldap 3.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,268 kB
  • sloc: python: 9,625; ansic: 2,828; makefile: 132; sh: 68
file content (12 lines) | stat: -rw-r--r-- 409 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
import os,ldap,pickle

temp_file_name = os.path.join(os.environ.get('TMP','/tmp'),'pickle_ldap-%d' % (os.getpid()))

l1 = ldap.ldapobject.ReconnectLDAPObject('ldap://localhost:1390',trace_level=1)
l1.protocol_version = 3
l1.search_s('',ldap.SCOPE_BASE,'(objectClass=*)')

pickle.dump(l1,open(temp_file_name,'wb'))

l2 = pickle.load(open(temp_file_name,'rb'))
l2.search_s('',ldap.SCOPE_BASE,'(objectClass=*)')