Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
abb636c1
Kaydet (Commit)
abb636c1
authored
Eki 13, 2017
tarafından
Tom
Kaydeden (comit)
Tim Graham
Eki 13, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improved performance of utils.html.escape().
üst
6c92f711
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
functional.py
django/utils/functional.py
+2
-1
html.py
django/utils/html.py
+9
-4
No files found.
django/utils/functional.py
Dosyayı görüntüle @
abb636c1
import
copy
import
itertools
import
operator
from
functools
import
total_ordering
,
wraps
...
...
@@ -189,7 +190,7 @@ def keep_lazy(*resultclasses):
@wraps
(
func
)
def
wrapper
(
*
args
,
**
kwargs
):
for
arg
in
list
(
args
)
+
list
(
kwargs
.
values
()):
for
arg
in
itertools
.
chain
(
args
,
kwargs
.
values
()):
if
isinstance
(
arg
,
Promise
):
break
else
:
...
...
django/utils/html.py
Dosyayı görüntüle @
abb636c1
...
...
@@ -30,6 +30,14 @@ simple_url_re = re.compile(r'^https?://\[?\w', re.IGNORECASE)
simple_url_2_re
=
re
.
compile
(
r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)($|/.*)$'
,
re
.
IGNORECASE
)
simple_email_re
=
re
.
compile
(
r'^\S+@\S+\.\S+$'
)
_html_escapes
=
{
ord
(
'&'
):
'&'
,
ord
(
'<'
):
'<'
,
ord
(
'>'
):
'>'
,
ord
(
'"'
):
'"'
,
ord
(
"'"
):
'''
,
}
@keep_lazy
(
str
,
SafeText
)
def
escape
(
text
):
...
...
@@ -41,10 +49,7 @@ def escape(text):
This may result in double-escaping. If this is a concern, use
conditional_escape() instead.
"""
return
mark_safe
(
str
(
text
)
.
replace
(
'&'
,
'&'
)
.
replace
(
'<'
,
'<'
)
.
replace
(
'>'
,
'>'
)
.
replace
(
'"'
,
'"'
)
.
replace
(
"'"
,
'''
)
)
return
mark_safe
(
str
(
text
)
.
translate
(
_html_escapes
))
_js_escapes
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment