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
d8f6b55a
Kaydet (Commit)
d8f6b55a
authored
Haz 08, 2014
tarafından
Alex Gaynor
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Optimize is_protected_type slightly (used by force_text, which is used basically everywhere)
üst
4ce7a6bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
encoding.py
django/utils/encoding.py
+5
-2
No files found.
django/utils/encoding.py
Dosyayı görüntüle @
d8f6b55a
...
...
@@ -52,14 +52,17 @@ def smart_text(s, encoding='utf-8', strings_only=False, errors='strict'):
return
force_text
(
s
,
encoding
,
strings_only
,
errors
)
_PROTECTED_TYPES
=
six
.
integer_types
+
(
type
(
None
),
float
,
Decimal
,
datetime
.
datetime
,
datetime
.
date
,
datetime
.
time
)
def
is_protected_type
(
obj
):
"""Determine if the object instance is of a protected type.
Objects of protected types are preserved as-is when passed to
force_text(strings_only=True).
"""
return
isinstance
(
obj
,
six
.
integer_types
+
(
type
(
None
),
float
,
Decimal
,
datetime
.
datetime
,
datetime
.
date
,
datetime
.
time
))
return
isinstance
(
obj
,
_PROTECTED_TYPES
)
def
force_text
(
s
,
encoding
=
'utf-8'
,
strings_only
=
False
,
errors
=
'strict'
):
...
...
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