mirror of
https://github.com/Hopiu/django-watson.git
synced 2026-03-16 22:00:22 +00:00
Improved apostrophe escaping.
This commit is contained in:
parent
fb446b611c
commit
b3d677db2b
1 changed files with 1 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ def regex_from_word(word):
|
|||
def make_escaper(badchars):
|
||||
"""Creates an efficient escape function that strips the given characters from the string."""
|
||||
translation_table = dict((ord(c), None) for c in badchars)
|
||||
translation_table[ord("'")] = "''"
|
||||
def escaper(text):
|
||||
return force_text(text, errors="ignore").translate(translation_table)
|
||||
return escaper
|
||||
|
|
|
|||
Loading…
Reference in a new issue