git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@930
e071eeec-0327-468d-9b6a-
08194a12b294
from django.db.backends import BaseDatabaseFeatures, BaseDatabaseOperations
def escape_ldap_filter(value):
- value = str(value)
+ value = unicode(value)
return value.replace('\\', '\\5c') \
.replace('*', '\\2a') \
.replace('(', '\\28') \
class WhereTestCase(TestCase):
def test_escape(self):
+ self.assertEquals(escape_ldap_filter(u'fôöbàr'), u'fôöbàr')
self.assertEquals(escape_ldap_filter('foo*bar'), 'foo\\2abar')
self.assertEquals(escape_ldap_filter('foo(bar'), 'foo\\28bar')
self.assertEquals(escape_ldap_filter('foo)bar'), 'foo\\29bar')