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
8e8c9b90
Kaydet (Commit)
8e8c9b90
authored
Mar 02, 2013
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed getting default encoding in get_system_username
Refs #19933.
üst
21722702
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
__init__.py
django/contrib/auth/management/__init__.py
+2
-4
encoding.py
django/utils/encoding.py
+14
-8
No files found.
django/contrib/auth/management/__init__.py
Dosyayı görüntüle @
8e8c9b90
...
@@ -12,6 +12,7 @@ from django.core import exceptions
...
@@ -12,6 +12,7 @@ from django.core import exceptions
from
django.core.management.base
import
CommandError
from
django.core.management.base
import
CommandError
from
django.db
import
DEFAULT_DB_ALIAS
,
router
from
django.db
import
DEFAULT_DB_ALIAS
,
router
from
django.db.models
import
get_models
,
signals
from
django.db.models
import
get_models
,
signals
from
django.utils.encoding
import
DEFAULT_LOCALE_ENCODING
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.six.moves
import
input
from
django.utils.six.moves
import
input
...
@@ -133,11 +134,8 @@ def get_system_username():
...
@@ -133,11 +134,8 @@ def get_system_username():
# (a very restricted chroot environment, for example).
# (a very restricted chroot environment, for example).
return
''
return
''
if
not
six
.
PY3
:
if
not
six
.
PY3
:
default_locale
=
locale
.
getdefaultlocale
()[
1
]
if
not
default_locale
:
return
''
try
:
try
:
result
=
result
.
decode
(
default_locale
)
result
=
result
.
decode
(
DEFAULT_LOCALE_ENCODING
)
except
UnicodeDecodeError
:
except
UnicodeDecodeError
:
# UnicodeDecodeError - preventive treatment for non-latin Windows.
# UnicodeDecodeError - preventive treatment for non-latin Windows.
return
''
return
''
...
...
django/utils/encoding.py
Dosyayı görüntüle @
8e8c9b90
...
@@ -236,11 +236,17 @@ def filepath_to_uri(path):
...
@@ -236,11 +236,17 @@ def filepath_to_uri(path):
# some flexibility for hardcoding separators.
# some flexibility for hardcoding separators.
return
quote
(
force_bytes
(
path
.
replace
(
"
\\
"
,
"/"
)),
safe
=
b
"/~!*()'"
)
return
quote
(
force_bytes
(
path
.
replace
(
"
\\
"
,
"/"
)),
safe
=
b
"/~!*()'"
)
# The encoding of the default system locale but falls back to the
def
get_system_encoding
():
# given fallback encoding if the encoding is unsupported by python or could
"""
# not be determined. See tickets #10335 and #5846
The encoding of the default system locale but falls back to the given
try
:
fallback encoding if the encoding is unsupported by python or could
DEFAULT_LOCALE_ENCODING
=
locale
.
getdefaultlocale
()[
1
]
or
'ascii'
not be determined. See tickets #10335 and #5846
codecs
.
lookup
(
DEFAULT_LOCALE_ENCODING
)
"""
except
:
try
:
DEFAULT_LOCALE_ENCODING
=
'ascii'
encoding
=
locale
.
getdefaultlocale
()[
1
]
or
'ascii'
codecs
.
lookup
(
encoding
)
except
Exception
:
encoding
=
'ascii'
return
encoding
DEFAULT_LOCALE_ENCODING
=
get_system_encoding
()
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