Skip to main content

This module provide an easy way to deal with ldap stuff in python.

Project description

This module provide an easy way to deal with ldap stuff in python.

This module is actively used on http://www.afpy.org to manage the french python comunity members.

Get a connection:

>>> from afpy.ldap import custom as ldap
>>> conn = ldap.get_conn()
>>> dn = 'uid=gawel,ou=members,dc=afpy,dc=org'
>>> node = conn.get_node(dn)
>>> node
<Node at uid=gawel,ou=members,dc=afpy,dc=org>

>>> print node.birthDate
19750410000000Z


>>> from afpy.ldap.node import Node
>>> from afpy.ldap import schema
>>> class User(Node):
...     uid=schema.StringProperty('uid')
...     birthDate = schema.DateProperty('birthDate', title='Date de naissance')
>>> node = conn.get_node(dn, node_class=User)
>>> node
<User at uid=gawel,ou=members,dc=afpy,dc=org>
>>> node.birthDate
datetime.date(1975, 4, 10)

Generate forms with FormAlchemy:

>>> from afpy.ldap import forms
>>> fs = forms.FieldSet(User)
>>> user = User()
>>> fs.rebind(user)
>>> print fs.render().strip() # doctest: +ELLIPSIS
<div>
  <label class="field_opt" for="User--uid">uid</label>
  <input id="User--uid" name="User--uid" type="text" />
</div>
...
<div>
  <label class="field_opt" for="User--birthDate">Date de naissance</label>
...

The source code can be find on the AFPy repository

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afpy.ldap-0.1.tar.gz (25.8 kB view details)

Uploaded Source

File details

Details for the file afpy.ldap-0.1.tar.gz.

File metadata

  • Download URL: afpy.ldap-0.1.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for afpy.ldap-0.1.tar.gz
Algorithm Hash digest
SHA256 aad37350dce7d2519bf0452258a895a27628d6cbb80a346565150ea8309dec24
MD5 ef24a035808f80fe6eff66d606c9e7fa
BLAKE2b-256 a4f91f2fd86195ce27d48eae789eb01507e7781058716a9118242489730eaa75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page