# Path: ldaptor/interfaces.py
# class ILDAPEntry(Interface):
# class IEditableLDAPEntry(Interface):
# class IConnectedLDAPEntry(Interface):
# class ILDAPConfig(Interface):
#     def __getitem__(self, key):
#     def get(self, key, default=None):
#     def has_key(self, key):
#     def __contains__(self, key):
#     def keys(self):
#     def items(self):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __len__(self):
#     def __nonzero__(self):
#     def bind(self, password):
#     def __setitem__(self, key, value):
#     def __delitem__(self, key):
#     def undo(self):
#     def commit(self):
#     def move(self, newDN):
#     def delete(self):
#     def setPassword(self, newPasswd):
#     def namingContext(self):
#     def fetch(self, *attributes):
#     def search(self,
#                filterText=None,
#                filterObject=None,
#                attributes=(),
#                scope=None,
#                derefAliases=None,
#                sizeLimit=0,
#                timeLimit=0,
#                typesOnly=0,
#                callback=None):
#     def children(self, callback=None):
#     def subtree(self, callback=None):
#     def lookup(self, dn):
#     def match(self, filter):
#     def getBaseDN(self):
#     def getServiceLocationOverrides(self):
#     def copy(self,
#              baseDN=None,
#              serviceLocationOverrides=None):
#     def getIdentityBaseDN(self):
#     def getIdentitySearch(self, name):
# 
# Path: ldaptor/insensitive.py
# class InsensitiveString(str):
#     """A str subclass that performs all matching without regard to case."""
# 
#     def __eq__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() == other.lower()
#         else:
#             return super(InsensitiveString, self).__eq__(other)
# 
#     def __ne__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() != other.lower()
#         else:
#             return super(InsensitiveString, self).__ne__(self, other)
# 
#     def __ge__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() >= other.lower()
#         else:
#             return super(InsensitiveString, self).__ge__(self, other)
# 
#     def __gt__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() > other.lower()
#         else:
#             return super(InsensitiveString, self).__gt__(self, other)
# 
#     def __le__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() <= other.lower()
#         else:
#             return super(InsensitiveString, self).__le__(self, other)
# 
#     def __lt__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() < other.lower()
#         else:
#             return super(InsensitiveString, self).__lt__(self, other)
# 
#     def __hash__(self):
#         return hash(self.lower())
# 
#     def __contains__(self, other):
#         if isinstance(other, basestring):
#             return other.lower() in self.lower()
#         else:
#             return super(InsensitiveString, self).__contains__(self, other)
# 
#     def __getslice__(self, *a, **kw):
#         r = super(InsensitiveString, self).__getslice__(*a, **kw)
#         return self.__class__(r)
# 
# Path: ldaptor/protocols/ldap/distinguishedname.py
# def escape(s):
# def unescape(s):
# def _splitOnNotEscaped(s, separator):
#     def __init__(self, rdn):
#     def __str__(self):
#     def __init__(self, stringValue=None, attributeType=None, value=None):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __lt__(self, other):
#     def __gt__(self, other):
#     def __le__(self, other):
#     def __ge__(self, other):
#     def __init__(self, magic=None, stringValue=None, attributeTypesAndValues=None):
#     def split(self):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __lt__(self, other):
#     def __gt__(self, other):
#     def __le__(self, other):
#     def __ge__(self, other):
#     def count(self):
#     def __init__(self, magic=None, stringValue=None, listOfRDNs=None):
#     def split(self):
#     def up(self):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __cmp__(self, other):
#     def getDomainName(self):
#     def contains(self, other):
# class InvalidRelativeDistinguishedName(Exception):
# class LDAPAttributeTypeAndValue:
# class RelativeDistinguishedName:
# class DistinguishedName:


import os.path
import ConfigParser
from zope.interface import implements
from ldaptor import interfaces
from ldaptor.insensitive import InsensitiveString
from ldaptor.protocols.ldap import distinguishedname

class MissingBaseDNError(Exception):
    """Configuration must specify a base DN"""

    def __str__(self):
        return self.__doc__

class LDAPConfig(object):
    implements(interfaces.ILDAPConfig)

    baseDN = None
    identityBaseDN = None
    identitySearch = None

    def __init__(self,
                 baseDN=None,
                 serviceLocationOverrides=None,
                 identityBaseDN=None,
                 identitySearch=None):
        if baseDN is not None:
            baseDN = distinguishedname.DistinguishedName(baseDN)
            self.baseDN = baseDN
        self.serviceLocationOverrides = {}
        if serviceLocationOverrides is not None:
            for k,v in serviceLocationOverrides.items():
                dn = distinguishedname.DistinguishedName(k)
                self.serviceLocationOverrides[dn]=v
        if identityBaseDN is not None:

# Path: ldaptor/interfaces.py
# class ILDAPEntry(Interface):
# class IEditableLDAPEntry(Interface):
# class IConnectedLDAPEntry(Interface):
# class ILDAPConfig(Interface):
#     def __getitem__(self, key):
#     def get(self, key, default=None):
#     def has_key(self, key):
#     def __contains__(self, key):
#     def keys(self):
#     def items(self):
#     def __str__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __len__(self):
#     def __nonzero__(self):
#     def bind(self, password):
#     def __setitem__(self, key, value):
#     def __delitem__(self, key):
#     def undo(self):
#     def commit(self):
#     def move(self, newDN):
#     def delete(self):
#     def setPassword(self, newPasswd):
#     def namingContext(self):
#     def fetch(self, *attributes):
#     def search(self,
#                filterText=None,
#                filterObject=None,
#                attributes=(),
#                scope=None,
#                derefAliases=None,
#                sizeLimit=0,
#                timeLimit=0,
#                typesOnly=0,
#                callback=None):
#     def children(self, callback=None):
#     def subtree(self, callback=None):
#     def lookup(self, dn):
#     def match(self, filter):
#     def getBaseDN(self):
#     def getServiceLocationOverrides(self):
#     def copy(self,
#              baseDN=None,
#              serviceLocationOverrides=None):
#     def getIdentityBaseDN(self):
#     def getIdentitySearch(self, name):
# 
# Path: ldaptor/insensitive.py
# class InsensitiveString(str):
#     """A str subclass that performs all matching without regard to case."""
# 
#     def __eq__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() == other.lower()
#         else:
#             return super(InsensitiveString, self).__eq__(other)
# 
#     def __ne__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() != other.lower()
#         else:
#             return super(InsensitiveString, self).__ne__(self, other)
# 
#     def __ge__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() >= other.lower()
#         else:
#             return super(InsensitiveString, self).__ge__(self, other)
# 
#     def __gt__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() > other.lower()
#         else:
#             return super(InsensitiveString, self).__gt__(self, other)
# 
#     def __le__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() <= other.lower()
#         else:
#             return super(InsensitiveString, self).__le__(self, other)
# 
#     def __lt__(self, other):
#         if isinstance(other, basestring):
#             return self.lower() < other.lower()
#         else:
#             return super(InsensitiveString, self).__lt__(self, other)
# 
#     def __hash__(self):
#         return hash(self.lower())
# 
#     def __contains__(self, other):
#         if isinstance(other, basestring):
#             return other.lower() in self.lower()
#         else:
#             return super(InsensitiveString, self).__contains__(self, other)
# 
#     def __getslice__(self, *a, **kw):
#         r = super(InsensitiveString, self).__getslice__(*a, **kw)
#         return self.__class__(r)
# 
# Path: ldaptor/protocols/ldap/distinguishedname.py
# def escape(s):
# def unescape(s):
# def _splitOnNotEscaped(s, separator):
#     def __init__(self, rdn):
#     def __str__(self):
#     def __init__(self, stringValue=None, attributeType=None, value=None):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __lt__(self, other):
#     def __gt__(self, other):
#     def __le__(self, other):
#     def __ge__(self, other):
#     def __init__(self, magic=None, stringValue=None, attributeTypesAndValues=None):
#     def split(self):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __lt__(self, other):
#     def __gt__(self, other):
#     def __le__(self, other):
#     def __ge__(self, other):
#     def count(self):
#     def __init__(self, magic=None, stringValue=None, listOfRDNs=None):
#     def split(self):
#     def up(self):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __cmp__(self, other):
#     def getDomainName(self):
#     def contains(self, other):
# class InvalidRelativeDistinguishedName(Exception):
# class LDAPAttributeTypeAndValue:
# class RelativeDistinguishedName:
# class DistinguishedName:


# Path: ldaptor/config.py
import os.path
import ConfigParser
from zope.interface import implements
from ldaptor import interfaces
from ldaptor.insensitive import InsensitiveString
from ldaptor.protocols.ldap import distinguishedname


class MissingBaseDNError(Exception):
    """Configuration must specify a base DN"""

    def __str__(self):
        return self.__doc__

class LDAPConfig(object):
    implements(interfaces.ILDAPConfig)

    baseDN = None
    identityBaseDN = None
    identitySearch = None

    def __init__(self,
                 baseDN=None,
                 serviceLocationOverrides=None,
                 identityBaseDN=None,
                 identitySearch=None):
        if baseDN is not None:
            baseDN = distinguishedname.DistinguishedName(baseDN)
            self.baseDN = baseDN
        self.serviceLocationOverrides = {}
        if serviceLocationOverrides is not None:
            for k,v in serviceLocationOverrides.items():
                dn = distinguishedname.DistinguishedName(k)
                self.serviceLocationOverrides[dn]=v
        if identityBaseDN is not None:

            identityBaseDN = distinguishedname.DistinguishedName(identityBaseDN)