from django.conf import settings
from django.db.backends import BaseDatabaseFeatures, BaseDatabaseOperations
-def convert(field, value, func):
- # FIXME : we should not reference the attribute name!
- if not value or field == 'jpegPhoto':
- return value
- elif isinstance(value, int):
- return str(value)
- elif isinstance(value, list):
- return [ func(x) for x in value ]
- else:
- return func(value)
-
def escape_ldap_filter(value):
value = str(value)
return value.replace('\\', '\\5c') \
results = cursor.connection.search_s(base, scope, filterstr.encode(self.charset), attrlist)
output = []
for dn, attrs in results:
- for field in attrs:
- attrs[field] = convert(field, attrs[field], lambda x: x.decode(self.charset))
output.append((dn.decode(self.charset), attrs))
return output