1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #2456 -- Added backslash escaping to addslashes, which is necessary once

you start escaping other things. Thanks, tom@eggdrop.ch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3799 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2006-09-23 08:41:09 +00:00
parent 93597d051d
commit 670e8ab704
2 changed files with 4 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ register = Library()
def addslashes(value):
"Adds slashes - useful for passing strings to JavaScript, for example."
return value.replace('"', '\\"').replace("'", "\\'")
return value.replace('\\', '\\\\').replace('"', '\\"').replace("'", "\\'")
def capfirst(value):
"Capitalizes the first character of the value"