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
3541a10d
Kaydet (Commit)
3541a10d
authored
Eki 23, 2012
tarafından
Carl Meyer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19164 -- Fixed diffsettings command broken in fix for #18545.
Thanks Mario César for the report and draft patch.
üst
ea57112d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
__init__.py
django/conf/__init__.py
+4
-3
tests.py
tests/regressiontests/admin_scripts/tests.py
+12
-0
No files found.
django/conf/__init__.py
Dosyayı görüntüle @
3541a10d
...
...
@@ -25,7 +25,7 @@ class LazySettings(LazyObject):
The user can manually configure settings prior to using them. Otherwise,
Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE.
"""
def
_setup
(
self
,
name
):
def
_setup
(
self
,
name
=
None
):
"""
Load the settings module pointed to by the environment variable. This
is used the first time we need any settings at all, if the user has not
...
...
@@ -36,11 +36,12 @@ class LazySettings(LazyObject):
if
not
settings_module
:
# If it's set but is an empty string.
raise
KeyError
except
KeyError
:
desc
=
(
"setting
%
s"
%
name
)
if
name
else
"settings"
raise
ImproperlyConfigured
(
"Requested
setting
%
s, but settings are not configured. "
"Requested
%
s, but settings are not configured. "
"You must either define the environment variable
%
s "
"or call settings.configure() before accessing settings."
%
(
name
,
ENVIRONMENT_VARIABLE
))
%
(
desc
,
ENVIRONMENT_VARIABLE
))
self
.
_wrapped
=
Settings
(
settings_module
)
self
.
_configure_logging
()
...
...
tests/regressiontests/admin_scripts/tests.py
Dosyayı görüntüle @
3541a10d
...
...
@@ -1603,3 +1603,15 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
with
codecs
.
open
(
path
,
'r'
,
'utf-8'
)
as
f
:
self
.
assertEqual
(
f
.
read
(),
'Some non-ASCII text for testing ticket #18091:
\n
üäö €
\n
'
)
class
DiffSettings
(
AdminScriptTestCase
):
"""Tests for diffsettings management command."""
def
test_basic
(
self
):
"Runs without error and emits settings diff."
self
.
write_settings
(
'settings_to_diff.py'
,
sdict
=
{
'FOO'
:
'"bar"'
})
args
=
[
'diffsettings'
,
'--settings=settings_to_diff'
]
out
,
err
=
self
.
run_manage
(
args
)
self
.
remove_settings
(
'settings_to_diff.py'
)
self
.
assertNoOutput
(
err
)
self
.
assertOutput
(
out
,
"FOO = 'bar' ###"
)
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