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
0922bbf1
Kaydet (Commit)
0922bbf1
authored
Eki 12, 2015
tarafından
Yusuke Miyazaki
Kaydeden (comit)
Tim Graham
Eki 17, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25346 -- Allowed collectstatic to delete broken symlinks.
üst
a3fffdca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
collectstatic.py
.../contrib/staticfiles/management/commands/collectstatic.py
+6
-1
test_management.py
tests/staticfiles_tests/test_management.py
+12
-2
No files found.
django/contrib/staticfiles/management/commands/collectstatic.py
Dosyayı görüntüle @
0922bbf1
...
...
@@ -218,7 +218,12 @@ class Command(BaseCommand):
smart_text
(
fpath
),
level
=
1
)
else
:
self
.
log
(
"Deleting '
%
s'"
%
smart_text
(
fpath
),
level
=
1
)
self
.
storage
.
delete
(
fpath
)
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
:
self
.
storage
.
delete
(
fpath
)
for
d
in
dirs
:
self
.
clear_dir
(
os
.
path
.
join
(
path
,
d
))
...
...
tests/staticfiles_tests/test_management.py
Dosyayı görüntüle @
0922bbf1
...
...
@@ -323,8 +323,8 @@ class TestCollectionLinks(CollectionTestCase, TestDefaults):
the standard file resolving tests here, to make sure using
``--link`` does not change the file-selection semantics.
"""
def
run_collectstatic
(
self
):
super
(
TestCollectionLinks
,
self
)
.
run_collectstatic
(
link
=
True
)
def
run_collectstatic
(
self
,
clear
=
False
):
super
(
TestCollectionLinks
,
self
)
.
run_collectstatic
(
link
=
True
,
clear
=
clear
)
def
test_links_created
(
self
):
"""
...
...
@@ -340,3 +340,13 @@ class TestCollectionLinks(CollectionTestCase, TestDefaults):
os
.
unlink
(
path
)
self
.
run_collectstatic
()
self
.
assertTrue
(
os
.
path
.
islink
(
path
))
def
test_clear_broken_symlink
(
self
):
"""
With ``--clear``, broken symbolic links are deleted.
"""
nonexistent_file_path
=
os
.
path
.
join
(
settings
.
STATIC_ROOT
,
'nonexistent.txt'
)
broken_symlink_path
=
os
.
path
.
join
(
settings
.
STATIC_ROOT
,
'symlink.txt'
)
os
.
symlink
(
nonexistent_file_path
,
broken_symlink_path
)
self
.
run_collectstatic
(
clear
=
True
)
self
.
assertFalse
(
os
.
path
.
lexists
(
broken_symlink_path
))
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