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
9a028513
Kaydet (Commit)
9a028513
authored
Eki 27, 2012
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #17744 -- Reset default file storage with setting_changed signal
üst
43d7cee8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
signals.py
django/test/signals.py
+7
-0
testing.txt
docs/topics/testing.txt
+10
-9
tests.py
tests/regressiontests/staticfiles_tests/tests.py
+2
-7
No files found.
django/test/signals.py
Dosyayı görüntüle @
9a028513
...
...
@@ -5,6 +5,7 @@ from django.conf import settings
from
django.db
import
connections
from
django.dispatch
import
receiver
,
Signal
from
django.utils
import
timezone
from
django.utils.functional
import
empty
template_rendered
=
Signal
(
providing_args
=
[
"template"
,
"context"
])
...
...
@@ -72,3 +73,9 @@ def language_changed(**kwargs):
trans_real
.
_default
=
None
if
kwargs
[
'setting'
]
==
'LOCALE_PATHS'
:
trans_real
.
_translations
=
{}
@receiver
(
setting_changed
)
def
file_storage_changed
(
**
kwargs
):
if
kwargs
[
'setting'
]
in
(
'MEDIA_ROOT'
,
'DEFAULT_FILE_STORAGE'
):
from
django.core.files.storage
import
default_storage
default_storage
.
_wrapped
=
empty
docs/topics/testing.txt
Dosyayı görüntüle @
9a028513
...
...
@@ -1594,15 +1594,16 @@ callbacks to clean up and otherwise reset state when settings are changed.
Django itself uses this signal to reset various data:
=========================== ========================
Overriden settings Data reset
=========================== ========================
USE_TZ, TIME_ZONE Databases timezone
TEMPLATE_CONTEXT_PROCESSORS Context processors cache
TEMPLATE_LOADERS Template loaders cache
SERIALIZATION_MODULES Serializers cache
LOCALE_PATHS, LANGUAGE_CODE Default translation and loaded translations
=========================== ========================
================================ ========================
Overriden settings Data reset
================================ ========================
USE_TZ, TIME_ZONE Databases timezone
TEMPLATE_CONTEXT_PROCESSORS Context processors cache
TEMPLATE_LOADERS Template loaders cache
SERIALIZATION_MODULES Serializers cache
LOCALE_PATHS, LANGUAGE_CODE Default translation and loaded translations
MEDIA_ROOT, DEFAULT_FILE_STORAGE Default file storage
================================ ========================
Emptying the test outbox
~~~~~~~~~~~~~~~~~~~~~~~~
...
...
tests/regressiontests/staticfiles_tests/tests.py
Dosyayı görüntüle @
9a028513
...
...
@@ -12,7 +12,6 @@ from django.template import loader, Context
from
django.conf
import
settings
from
django.core.cache.backends.base
import
BaseCache
from
django.core.exceptions
import
ImproperlyConfigured
from
django.core.files.storage
import
default_storage
from
django.core.management
import
call_command
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
...
...
@@ -48,10 +47,9 @@ class BaseStaticFilesTestCase(object):
Test case with a couple utility assertions.
"""
def
setUp
(
self
):
# Clear the cached
default
_storage out, this is because when it first
# gets accessed (by some other test), it evaluates settings.
MEDIA
_ROOT,
# Clear the cached
staticfiles
_storage out, this is because when it first
# gets accessed (by some other test), it evaluates settings.
STATIC
_ROOT,
# since we're planning on changing that we need to clear out the cache.
default_storage
.
_wrapped
=
empty
storage
.
staticfiles_storage
.
_wrapped
=
empty
# Clear the cached staticfile finders, so they are reinitialized every
# run and pick up changes in settings.STATICFILES_DIRS.
...
...
@@ -709,9 +707,6 @@ class TestMiscFinder(TestCase):
"""
A few misc finder tests.
"""
def
setUp
(
self
):
default_storage
.
_wrapped
=
empty
def
test_get_finder
(
self
):
self
.
assertIsInstance
(
finders
.
get_finder
(
'django.contrib.staticfiles.finders.FileSystemFinder'
),
...
...
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