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
28bcff82
Kaydet (Commit)
28bcff82
authored
Mar 14, 2016
tarafından
Berker Peksag
Kaydeden (comit)
Tim Graham
Mar 17, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26297 -- Fixed `collectstatic --clear` crash if storage doesn't implement path().
üst
ecb59cc6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
5 deletions
+54
-5
collectstatic.py
.../contrib/staticfiles/management/commands/collectstatic.py
+9
-5
1.9.5.txt
docs/releases/1.9.5.txt
+3
-0
storage.py
tests/staticfiles_tests/storage.py
+37
-0
test_management.py
tests/staticfiles_tests/test_management.py
+5
-0
No files found.
django/contrib/staticfiles/management/commands/collectstatic.py
Dosyayı görüntüle @
28bcff82
...
...
@@ -221,12 +221,16 @@ class Command(BaseCommand):
smart_text
(
fpath
),
level
=
1
)
else
:
self
.
log
(
"Deleting '
%
s'"
%
smart_text
(
fpath
),
level
=
1
)
full_path
=
self
.
storage
.
path
(
fpath
)
if
not
os
.
path
.
exists
(
full_path
)
and
os
.
path
.
lexists
(
full_path
):
# Delete broken symlinks
os
.
unlink
(
full_path
)
else
:
try
:
full_path
=
self
.
storage
.
path
(
fpath
)
except
NotImplementedError
:
self
.
storage
.
delete
(
fpath
)
else
:
if
not
os
.
path
.
exists
(
full_path
)
and
os
.
path
.
lexists
(
full_path
):
# Delete broken symlinks
os
.
unlink
(
full_path
)
else
:
self
.
storage
.
delete
(
fpath
)
for
d
in
dirs
:
self
.
clear_dir
(
os
.
path
.
join
(
path
,
d
))
...
...
docs/releases/1.9.5.txt
Dosyayı görüntüle @
28bcff82
...
...
@@ -27,3 +27,6 @@ Bugfixes
earlier versions of Django.
* Fixed a memory leak in the cached template loader (:ticket:`26306`).
* Fixed a regression that caused ``collectstatic --clear`` to fail if the
storage doesn't implement ``path()`` (:ticket:`26297`).
tests/staticfiles_tests/storage.py
Dosyayı görüntüle @
28bcff82
import
errno
import
os
from
datetime
import
datetime
from
django.conf
import
settings
from
django.contrib.staticfiles.storage
import
CachedStaticFilesStorage
from
django.core.files
import
storage
from
django.utils
import
timezone
...
...
@@ -22,6 +25,40 @@ class DummyStorage(storage.Storage):
return
datetime
.
datetime
(
1970
,
1
,
1
,
tzinfo
=
timezone
.
utc
)
class
PathNotImplementedStorage
(
storage
.
Storage
):
def
_save
(
self
,
name
,
content
):
return
'dummy'
def
_path
(
self
,
name
):
return
os
.
path
.
join
(
settings
.
STATIC_ROOT
,
name
)
def
exists
(
self
,
name
):
return
os
.
path
.
exists
(
self
.
_path
(
name
))
def
listdir
(
self
,
path
):
path
=
self
.
_path
(
path
)
directories
,
files
=
[],
[]
for
entry
in
os
.
listdir
(
path
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
path
,
entry
)):
directories
.
append
(
entry
)
else
:
files
.
append
(
entry
)
return
directories
,
files
def
delete
(
self
,
name
):
name
=
self
.
_path
(
name
)
if
os
.
path
.
exists
(
name
):
try
:
os
.
remove
(
name
)
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
def
path
(
self
,
name
):
raise
NotImplementedError
class
SimpleCachedStaticFilesStorage
(
CachedStaticFilesStorage
):
def
file_hash
(
self
,
name
,
content
=
None
):
...
...
tests/staticfiles_tests/test_management.py
Dosyayı görüntüle @
28bcff82
...
...
@@ -170,6 +170,11 @@ class TestCollectionClear(CollectionTestCase):
shutil
.
rmtree
(
six
.
text_type
(
settings
.
STATIC_ROOT
))
super
(
TestCollectionClear
,
self
)
.
run_collectstatic
(
clear
=
True
)
@override_settings
(
STATICFILES_STORAGE
=
'staticfiles_tests.storage.PathNotImplementedStorage'
)
def
test_handle_path_notimplemented
(
self
):
self
.
run_collectstatic
()
self
.
assertFileNotFound
(
'cleared.txt'
)
class
TestCollectionExcludeNoDefaultIgnore
(
CollectionTestCase
,
TestDefaults
):
"""
...
...
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