mirror of
https://github.com/django/django.git
synced 2025-12-09 19:08:06 +00:00
Fixed #21867 -- Removed AppStaticStorage; app paths are now AppConfig's job.
AppStaticStorage only provided one thing over FileSystemStorage, which was taking an app name (import path) and translating it into a filesystem path. This is now something that should be done via app_config.path instead, leaving AppStaticStorage with no reason for existence. It should be safe to remove, as it was undocumented internal API. There was some kind of feature in the AppDirectoriesFinder code related to a "prefix" attribute on the storage class used by AppDirectoriesFinder. Since this feature was undocumented, untested, and of unclear purpose, I removed it as well.
This commit is contained in:
parent
06bd181f97
commit
f56c88a8ee
3 changed files with 13 additions and 68 deletions
|
|
@ -824,37 +824,6 @@ class TestTemplateTag(StaticFilesTestCase):
|
|||
self.assertStaticRenders("testfile.txt", "/static/testfile.txt")
|
||||
|
||||
|
||||
class TestAppStaticStorage(TestCase):
|
||||
def setUp(self):
|
||||
# Creates a python module foo_module in a directory with non ascii
|
||||
# characters
|
||||
self.search_path = 'search_path_\xc3\xbc'
|
||||
os.mkdir(self.search_path)
|
||||
module_path = os.path.join(self.search_path, 'foo_module')
|
||||
os.mkdir(module_path)
|
||||
self.init_file = open(os.path.join(module_path, '__init__.py'), 'w')
|
||||
sys.path.append(os.path.abspath(self.search_path))
|
||||
|
||||
def tearDown(self):
|
||||
self.init_file.close()
|
||||
sys.path.remove(os.path.abspath(self.search_path))
|
||||
shutil.rmtree(self.search_path)
|
||||
|
||||
def test_app_with_non_ascii_characters_in_path(self):
|
||||
"""
|
||||
Regression test for #18404 - Tests AppStaticStorage with a module that
|
||||
has non ascii characters in path and a non utf8 file system encoding
|
||||
"""
|
||||
# set file system encoding to a non unicode encoding
|
||||
old_enc_func = sys.getfilesystemencoding
|
||||
sys.getfilesystemencoding = lambda: 'ISO-8859-1'
|
||||
try:
|
||||
st = storage.AppStaticStorage('foo_module')
|
||||
st.path('bar')
|
||||
finally:
|
||||
sys.getfilesystemencoding = old_enc_func
|
||||
|
||||
|
||||
class CustomStaticFilesStorage(storage.StaticFilesStorage):
|
||||
"""
|
||||
Used in TestStaticFilePermissions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue