X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2Fmodels%2Ffields.py;fp=ldapdb%2Fmodels%2Ffields.py;h=88b52522814bf259ec164a731ad3b265be686fd9;hp=78ec1c7569f3421d2b856e2d78856f70cbed70da;hb=5b97fccb66efc67de3ce0165528cd454b2245ddc;hpb=2af7bbb69791fc49de3bb91c5ce77c846434b53e diff --git a/ldapdb/models/fields.py b/ldapdb/models/fields.py index 78ec1c7..88b5252 100644 --- a/ldapdb/models/fields.py +++ b/ldapdb/models/fields.py @@ -25,6 +25,19 @@ class CharField(fields.CharField): kwargs['max_length'] = 200 super(CharField, self).__init__(*args, **kwargs) + def get_db_prep_value(self, value): + """Returns field's value prepared for interacting with the database + backend. + + Used by the default implementations of ``get_db_prep_save``and + `get_db_prep_lookup``` + """ + return value.replace('\\', '\\5c') + .replace('*', '\\2a') + .replace('(', '\\28') + .replace(')', '\\29') + .replace('\0', '\\00') + class ImageField(fields.Field): pass