Stripped trailing white-spaces

This commit is contained in:
stroeder
2015-06-06 09:21:37 +00:00
parent 036700dade
commit 7248568cb3
15 changed files with 60 additions and 60 deletions

View File

@@ -3,7 +3,7 @@ ldap.async - handle async LDAP operations
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: async.py,v 1.33 2013/09/21 03:55:38 stroeder Exp $ \$Id: async.py,v 1.34 2015/06/06 09:21:37 stroeder Exp $
Python compability note: Python compability note:
Tested on Python 2.0+ but should run on Python 1.5.x. Tested on Python 2.0+ but should run on Python 1.5.x.
@@ -103,7 +103,7 @@ class AsyncSearchHandler:
def afterFirstResult(self): def afterFirstResult(self):
""" """
Do anything you want right after successfully receiving but before Do anything you want right after successfully receiving but before
processing first result processing first result
""" """

View File

@@ -4,7 +4,7 @@ controls.py - support classes for LDAP controls
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
$Id: __init__.py,v 1.9 2013/05/29 20:27:32 stroeder Exp $ $Id: __init__.py,v 1.10 2015/06/06 09:21:38 stroeder Exp $
Description: Description:
The ldap.controls module provides LDAPControl classes. The ldap.controls module provides LDAPControl classes.
@@ -45,7 +45,7 @@ except ImportError:
class RequestControl: class RequestControl:
""" """
Base class for all request controls Base class for all request controls
controlType controlType
OID as string of the LDAPv3 extended request control OID as string of the LDAPv3 extended request control
criticality criticality

View File

@@ -5,7 +5,7 @@ by OpenLDAP functions
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
$Id: libldap.py,v 1.2 2011/07/23 07:42:04 stroeder Exp $ $Id: libldap.py,v 1.3 2015/06/06 09:21:38 stroeder Exp $
""" """
import _ldap,ldap import _ldap,ldap
@@ -20,8 +20,8 @@ class AssertionControl(RequestControl):
LDAP filter string specifying which assertions have to match LDAP filter string specifying which assertions have to match
so that the server processes the operation so that the server processes the operation
""" """
controlType = ldap.CONTROL_ASSERT controlType = ldap.CONTROL_ASSERT
def __init__(self,criticality=True,filterstr='(objectClass=*)'): def __init__(self,criticality=True,filterstr='(objectClass=*)'):
self.criticality = criticality self.criticality = criticality
self.filterstr = filterstr self.filterstr = filterstr
@@ -40,9 +40,9 @@ class MatchedValuesControl(RequestControl):
LDAP filter string specifying which attribute values LDAP filter string specifying which attribute values
should be returned should be returned
""" """
controlType = ldap.CONTROL_VALUESRETURNFILTER controlType = ldap.CONTROL_VALUESRETURNFILTER
def __init__(self,criticality=False,filterstr='(objectClass=*)'): def __init__(self,criticality=False,filterstr='(objectClass=*)'):
self.criticality = criticality self.criticality = criticality
self.filterstr = filterstr self.filterstr = filterstr

View File

@@ -5,7 +5,7 @@ ldap.controls.ppolicy - classes for Password Policy controls
See http://www.python-ldap.org/ for project details. See http://www.python-ldap.org/ for project details.
$Id: ppolicy.py,v 1.3 2011/11/27 15:26:06 stroeder Exp $ $Id: ppolicy.py,v 1.4 2015/06/06 09:21:38 stroeder Exp $
""" """
__all__ = [ __all__ = [
@@ -91,6 +91,6 @@ class PasswordPolicyControl(ValueLessRequestControl,ResponseControl):
self.error = None self.error = None
else: else:
self.error = int(error) self.error = int(error)
KNOWN_RESPONSE_CONTROLS[PasswordPolicyControl.controlType] = PasswordPolicyControl KNOWN_RESPONSE_CONTROLS[PasswordPolicyControl.controlType] = PasswordPolicyControl

View File

@@ -4,7 +4,7 @@ ldap.controls.simple - classes for some very simple LDAP controls
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
$Id: simple.py,v 1.9 2012/08/09 07:01:20 stroeder Exp $ $Id: simple.py,v 1.10 2015/06/06 09:21:38 stroeder Exp $
""" """
import struct,ldap import struct,ldap
@@ -34,7 +34,7 @@ class ValueLessRequestControl(RequestControl):
class OctetStringInteger(LDAPControl): class OctetStringInteger(LDAPControl):
""" """
Base class with controlValue being unsigend integer values Base class with controlValue being unsigend integer values
integerValue integerValue
Integer to be sent as OctetString Integer to be sent as OctetString
""" """
@@ -49,7 +49,7 @@ class OctetStringInteger(LDAPControl):
def decodeControlValue(self,encodedControlValue): def decodeControlValue(self,encodedControlValue):
self.integerValue = struct.unpack('!Q',encodedControlValue)[0] self.integerValue = struct.unpack('!Q',encodedControlValue)[0]
class BooleanControl(LDAPControl): class BooleanControl(LDAPControl):
""" """
@@ -100,7 +100,7 @@ KNOWN_RESPONSE_CONTROLS[ldap.CONTROL_RELAX] = RelaxRulesControl
class ProxyAuthzControl(RequestControl): class ProxyAuthzControl(RequestControl):
""" """
Proxy Authorization Control Proxy Authorization Control
authzId authzId
string containing the authorization ID indicating the identity string containing the authorization ID indicating the identity
on behalf which the server should process the request on behalf which the server should process the request
@@ -123,9 +123,9 @@ class AuthorizationIdentityRequestControl(ValueLessRequestControl):
class AuthorizationIdentityResponseControl(ResponseControl): class AuthorizationIdentityResponseControl(ResponseControl):
""" """
Authorization Identity Request and Response Controls Authorization Identity Request and Response Controls
Class attributes: Class attributes:
authzId authzId
decoded authorization identity decoded authorization identity
""" """

View File

@@ -3,7 +3,7 @@ dn.py - misc stuff for handling distinguished names (see RFC 4514)
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: dn.py,v 1.12 2014/05/20 20:15:15 stroeder Exp $ \$Id: dn.py,v 1.13 2015/06/06 09:21:37 stroeder Exp $
Compability: Compability:
- Tested with Python 2.0+ - Tested with Python 2.0+
@@ -31,7 +31,7 @@ def escape_dn_chars(s):
s = s.replace('>' ,'\\>') s = s.replace('>' ,'\\>')
s = s.replace(';' ,'\\;') s = s.replace(';' ,'\\;')
s = s.replace('=' ,'\\=') s = s.replace('=' ,'\\=')
s = s.replace('\000' ,'\\\000') s = s.replace('\000' ,'\\\000')
if s[0]=='#' or s[0]==' ': if s[0]=='#' or s[0]==' ':
s = ''.join(('\\',s)) s = ''.join(('\\',s))
if s[-1]==' ': if s[-1]==' ':
@@ -43,7 +43,7 @@ def str2dn(dn,flags=0):
""" """
This function takes a DN as string as parameter and returns This function takes a DN as string as parameter and returns
a decomposed DN. It's the inverse to dn2str(). a decomposed DN. It's the inverse to dn2str().
flags describes the format of the dn flags describes the format of the dn
See also the OpenLDAP man-page ldap_str2dn(3) See also the OpenLDAP man-page ldap_str2dn(3)
@@ -69,7 +69,7 @@ def dn2str(dn):
def explode_dn(dn,notypes=0,flags=0): def explode_dn(dn,notypes=0,flags=0):
""" """
explode_dn(dn [, notypes=0]) -> list explode_dn(dn [, notypes=0]) -> list
This function takes a DN and breaks it up into its component parts. This function takes a DN and breaks it up into its component parts.
The notypes parameter is used to specify that only the component's The notypes parameter is used to specify that only the component's
attribute values be returned and not the attribute types. attribute values be returned and not the attribute types.
@@ -95,7 +95,7 @@ def explode_dn(dn,notypes=0,flags=0):
def explode_rdn(rdn,notypes=0,flags=0): def explode_rdn(rdn,notypes=0,flags=0):
""" """
explode_rdn(rdn [, notypes=0]) -> list explode_rdn(rdn [, notypes=0]) -> list
This function takes a RDN and breaks it up into its component parts This function takes a RDN and breaks it up into its component parts
if it is a multi-valued RDN. if it is a multi-valued RDN.
The notypes parameter is used to specify that only the component's The notypes parameter is used to specify that only the component's

View File

@@ -3,7 +3,7 @@ filters.py - misc stuff for handling LDAP filter strings (see RFC2254)
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: filter.py,v 1.9 2011/07/22 07:20:53 stroeder Exp $ \$Id: filter.py,v 1.10 2015/06/06 09:21:37 stroeder Exp $
Compability: Compability:
- Tested with Python 2.0+ - Tested with Python 2.0+
@@ -16,7 +16,7 @@ def escape_filter_chars(assertion_value,escape_mode=0):
""" """
Replace all special characters found in assertion_value Replace all special characters found in assertion_value
by quoted notation. by quoted notation.
escape_mode escape_mode
If 0 only special chars mentioned in RFC 4515 are escaped. If 0 only special chars mentioned in RFC 4515 are escaped.
If 1 all NON-ASCII chars are escaped. If 1 all NON-ASCII chars are escaped.
@@ -41,7 +41,7 @@ def escape_filter_chars(assertion_value,escape_mode=0):
s = s.replace(r'(', r'\28') s = s.replace(r'(', r'\28')
s = s.replace(r')', r'\29') s = s.replace(r')', r'\29')
s = s.replace('\x00', r'\00') s = s.replace('\x00', r'\00')
return s return s
def filter_format(filter_template,assertion_values): def filter_format(filter_template,assertion_values):

View File

@@ -3,7 +3,7 @@ functions.py - wraps functions of module _ldap
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: functions.py,v 1.30 2014/05/20 20:44:28 stroeder Exp $ \$Id: functions.py,v 1.31 2015/06/06 09:21:37 stroeder Exp $
Compability: Compability:
- Tested with Python 2.0+ but should work with Python 1.5.x - Tested with Python 2.0+ but should work with Python 1.5.x
@@ -135,7 +135,7 @@ def set_option(option,invalue):
def escape_str(escape_func,s,*args): def escape_str(escape_func,s,*args):
""" """
Applies escape_func() to all items of `args' and returns a string based Applies escape_func() to all items of `args' and returns a string based
on format string `s'. on format string `s'.
""" """
escape_args = map(escape_func,args) escape_args = map(escape_func,args)

View File

@@ -3,7 +3,7 @@ ldapobject.py - wraps class _ldap.LDAPObject
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: ldapobject.py,v 1.144 2015/05/02 16:19:23 stroeder Exp $ \$Id: ldapobject.py,v 1.145 2015/06/06 09:21:38 stroeder Exp $
Compability: Compability:
- Tested with Python 2.0+ but should work with Python 1.5.x - Tested with Python 2.0+ but should work with Python 1.5.x
@@ -139,7 +139,7 @@ class SimpleLDAPObject:
def fileno(): def fileno():
""" """
Returns file description of LDAP connection. Returns file description of LDAP connection.
Just a convenience wrapper for LDAPObject.get_option(ldap.OPT_DESC) Just a convenience wrapper for LDAPObject.get_option(ldap.OPT_DESC)
""" """
return self.get_option(ldap.OPT_DESC) return self.get_option(ldap.OPT_DESC)
@@ -662,7 +662,7 @@ class SimpleLDAPObject:
def read_s(self,dn,filterstr=None,attrlist=None,serverctrls=None,clientctrls=None,timeout=-1): def read_s(self,dn,filterstr=None,attrlist=None,serverctrls=None,clientctrls=None,timeout=-1):
""" """
Reads and returns a single entry specified by `dn'. Reads and returns a single entry specified by `dn'.
Other attributes just like those passed to `search_ext_s()' Other attributes just like those passed to `search_ext_s()'
""" """
r = self.search_ext_s( r = self.search_ext_s(

View File

@@ -9,7 +9,7 @@ class logging_file_class:
def __init__(self,logging_level): def __init__(self,logging_level):
self._logging_level = logging_level self._logging_level = logging_level
def write(self,msg): def write(self,msg):
logging.log(self._logging_level,msg[:-1]) logging.log(self._logging_level,msg[:-1])

View File

@@ -3,7 +3,7 @@ sasl.py - support for SASL mechanism
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: sasl.py,v 1.16 2014/03/23 19:06:47 stroeder Exp $ \$Id: sasl.py,v 1.17 2015/06/06 09:21:38 stroeder Exp $
Description: Description:
The ldap.sasl module provides SASL authentication classes. The ldap.sasl module provides SASL authentication classes.
@@ -63,7 +63,7 @@ class sasl:
useful for writing generic sasl GUIs, which would need to know all useful for writing generic sasl GUIs, which would need to know all
the questions to ask, before the answers are returned to the sasl the questions to ask, before the answers are returned to the sasl
lib (in contrast to one question at a time).""" lib (in contrast to one question at a time)."""
# The following print command might be useful for debugging # The following print command might be useful for debugging
# new sasl mechanisms. So it is left here # new sasl mechanisms. So it is left here
cb_result = self.cb_value_dict.get(cb_id,defresult) or '' cb_result = self.cb_value_dict.get(cb_id,defresult) or ''
@@ -73,7 +73,7 @@ class sasl:
cb_id, challenge, prompt, repr(defresult), repr(self.cb_value_dict.get(cb_result)) cb_id, challenge, prompt, repr(defresult), repr(self.cb_value_dict.get(cb_result))
)) ))
return cb_result return cb_result
class cram_md5(sasl): class cram_md5(sasl):
"""This class handles SASL CRAM-MD5 authentication.""" """This class handles SASL CRAM-MD5 authentication."""

View File

@@ -3,7 +3,7 @@ schema.py - support for subSchemaSubEntry information
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: models.py,v 1.47 2014/03/12 21:44:10 stroeder Exp $ \$Id: models.py,v 1.48 2015/06/06 09:21:38 stroeder Exp $
""" """
import UserDict,ldap.cidict import UserDict,ldap.cidict
@@ -36,7 +36,7 @@ class SchemaElement:
Base class for all schema element classes. Not used directly! Base class for all schema element classes. Not used directly!
Arguments: Arguments:
schema_element_str schema_element_str
String which contains the schema element description to be parsed. String which contains the schema element description to be parsed.
@@ -51,7 +51,7 @@ class SchemaElement:
token_defaults = { token_defaults = {
'DESC':(None,), 'DESC':(None,),
} }
def __init__(self,schema_element_str=None): def __init__(self,schema_element_str=None):
if schema_element_str: if schema_element_str:
l = split_tokens(schema_element_str,self.token_defaults) l = split_tokens(schema_element_str,self.token_defaults)
@@ -72,7 +72,7 @@ class SchemaElement:
def key_attr(self,key,value,quoted=0): def key_attr(self,key,value,quoted=0):
assert value is None or type(value)==StringType,TypeError("value has to be of StringType, was %s" % repr(value)) assert value is None or type(value)==StringType,TypeError("value has to be of StringType, was %s" % repr(value))
if value: if value:
if quoted: if quoted:
return " %s '%s'" % (key,value.replace("'","\\'")) return " %s '%s'" % (key,value.replace("'","\\'"))
else: else:
return " %s %s" % (key,value) return " %s %s" % (key,value)
@@ -101,7 +101,7 @@ class SchemaElement:
class ObjectClass(SchemaElement): class ObjectClass(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an ObjectClassDescription String containing an ObjectClassDescription
@@ -194,7 +194,7 @@ AttributeUsage = ldap.cidict.cidict({
class AttributeType(SchemaElement): class AttributeType(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an AttributeTypeDescription String containing an AttributeTypeDescription
@@ -336,7 +336,7 @@ class LDAPSyntax(SchemaElement):
This string contains description text (DESC) of the LDAP syntax This string contains description text (DESC) of the LDAP syntax
not_human_readable not_human_readable
Integer flag (0 or 1) indicating whether the attribute type is marked Integer flag (0 or 1) indicating whether the attribute type is marked
as not human-readable (X-NOT-HUMAN-READABLE) as not human-readable (X-NOT-HUMAN-READABLE)
""" """
schema_attribute = 'ldapSyntaxes' schema_attribute = 'ldapSyntaxes'
token_defaults = { token_defaults = {
@@ -355,7 +355,7 @@ class LDAPSyntax(SchemaElement):
self.x_binary_transfer_required = d['X-BINARY-TRANSFER-REQUIRED'][0]=='TRUE' self.x_binary_transfer_required = d['X-BINARY-TRANSFER-REQUIRED'][0]=='TRUE'
assert self.desc is None or type(self.desc)==StringType assert self.desc is None or type(self.desc)==StringType
return return
def __str__(self): def __str__(self):
result = [str(self.oid)] result = [str(self.oid)]
result.append(self.key_attr('DESC',self.desc,quoted=1)) result.append(self.key_attr('DESC',self.desc,quoted=1))
@@ -369,7 +369,7 @@ class LDAPSyntax(SchemaElement):
class MatchingRule(SchemaElement): class MatchingRule(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an MatchingRuleDescription String containing an MatchingRuleDescription
@@ -418,7 +418,7 @@ class MatchingRule(SchemaElement):
class MatchingRuleUse(SchemaElement): class MatchingRuleUse(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an MatchingRuleUseDescription String containing an MatchingRuleUseDescription
@@ -468,7 +468,7 @@ class MatchingRuleUse(SchemaElement):
class DITContentRule(SchemaElement): class DITContentRule(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an DITContentRuleDescription String containing an DITContentRuleDescription
@@ -541,7 +541,7 @@ class DITContentRule(SchemaElement):
class DITStructureRule(SchemaElement): class DITStructureRule(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an DITStructureRuleDescription String containing an DITStructureRuleDescription
@@ -604,7 +604,7 @@ class DITStructureRule(SchemaElement):
class NameForm(SchemaElement): class NameForm(SchemaElement):
""" """
Arguments: Arguments:
schema_element_str schema_element_str
String containing an NameFormDescription String containing an NameFormDescription
@@ -670,7 +670,7 @@ class NameForm(SchemaElement):
class Entry(UserDict.UserDict): class Entry(UserDict.UserDict):
""" """
Schema-aware implementation of an LDAP entry class. Schema-aware implementation of an LDAP entry class.
Mainly it holds the attributes in a string-keyed dictionary with Mainly it holds the attributes in a string-keyed dictionary with
the OID as key. the OID as key.
""" """

View File

@@ -3,7 +3,7 @@ ldap.schema.subentry - subschema subentry handling
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: subentry.py,v 1.34 2013/09/13 18:02:47 stroeder Exp $ \$Id: subentry.py,v 1.35 2015/06/06 09:21:38 stroeder Exp $
""" """
import ldap.cidict,ldap.schema import ldap.cidict,ldap.schema
@@ -75,7 +75,7 @@ class SubSchema:
non_unique_oids non_unique_oids
List of OIDs used at least twice in the subschema List of OIDs used at least twice in the subschema
non_unique_names non_unique_names
List of NAMEs used at least twice in the subschema for the same schema element List of NAMEs used at least twice in the subschema for the same schema element
""" """
def __init__(self,sub_schema_sub_entry,check_uniqueness=1): def __init__(self,sub_schema_sub_entry,check_uniqueness=1):

View File

@@ -4,7 +4,7 @@ ldap.syncrepl - for implementing syncrepl consumer (see RFC 4533)
See http://www.python-ldap.org/ for project details. See http://www.python-ldap.org/ for project details.
$Id: syncrepl.py,v 1.6 2014/09/26 16:11:43 stroeder Exp $ $Id: syncrepl.py,v 1.7 2015/06/06 09:21:38 stroeder Exp $
""" """
#__all__ = [ #__all__ = [
@@ -316,9 +316,9 @@ class SyncreplConsumer:
methods to store the cookie appropriately, rather than methods to store the cookie appropriately, rather than
passing it. passing it.
Only a single syncrepl search may be active on a SyncreplConsumer Only a single syncrepl search may be active on a SyncreplConsumer
object. Multiple concurrent syncrepl searches require multiple object. Multiple concurrent syncrepl searches require multiple
separate SyncreplConsumer objects and thus multiple connections separate SyncreplConsumer objects and thus multiple connections
(LDAPObject instances). (LDAPObject instances).
""" """
if cookie is None: if cookie is None:

View File

@@ -3,7 +3,7 @@ ldapurl - handling of LDAP URLs as described in RFC 4516
See http://www.python-ldap.org/ for details. See http://www.python-ldap.org/ for details.
\$Id: ldapurl.py,v 1.71 2015/06/05 21:04:58 stroeder Exp $ \$Id: ldapurl.py,v 1.72 2015/06/06 09:21:37 stroeder Exp $
Python compability note: Python compability note:
This module only works with Python 2.0+ since This module only works with Python 2.0+ since
@@ -73,7 +73,7 @@ class LDAPUrlExtension:
Usable class attributes: Usable class attributes:
critical critical
Boolean integer marking the extension as critical Boolean integer marking the extension as critical
extype extype
Type of extension Type of extension
exvalue exvalue
Value of extension Value of extension
@@ -112,7 +112,7 @@ class LDAPUrlExtension:
'!'*(self.critical>0), '!'*(self.critical>0),
self.extype,quote(self.exvalue or '') self.extype,quote(self.exvalue or '')
) )
def __str__(self): def __str__(self):
return self.unparse() return self.unparse()
@@ -177,7 +177,7 @@ class LDAPUrlExtensions(UserDict.UserDict):
"other has to be instance of %s" % (self.__class__) "other has to be instance of %s" % (self.__class__)
) )
return self.data==other.data return self.data==other.data
def parse(self,extListStr): def parse(self,extListStr):
for extension_str in extListStr.strip().split(','): for extension_str in extListStr.strip().split(','):
if extension_str: if extension_str:
@@ -358,11 +358,11 @@ class LDAPUrl:
if self.extensions: if self.extensions:
ldap_url = ldap_url+'?'+self.extensions.unparse() ldap_url = ldap_url+'?'+self.extensions.unparse()
return ldap_url return ldap_url
def htmlHREF(self,urlPrefix='',hrefText=None,hrefTarget=None): def htmlHREF(self,urlPrefix='',hrefText=None,hrefTarget=None):
""" """
Returns a string with HTML link for this LDAP URL. Returns a string with HTML link for this LDAP URL.
urlPrefix urlPrefix
Prefix before LDAP URL (e.g. for addressing another web-based client) Prefix before LDAP URL (e.g. for addressing another web-based client)
hrefText hrefText