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
8fe40686
Kaydet (Commit)
8fe40686
authored
Agu 08, 2014
tarafından
Justin Hamade
Kaydeden (comit)
Claude Paroz
Agu 08, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22336 -- Added path matching for makemessages ignore option
This fixes a regression introduced by
9012a9e2
.
üst
09c0fa2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
18 deletions
+33
-18
makemessages.py
django/core/management/commands/makemessages.py
+2
-1
ignored.html
tests/i18n/commands/templates/subdir/ignored.html
+2
-0
test_extraction.py
tests/i18n/test_extraction.py
+29
-17
No files found.
django/core/management/commands/makemessages.py
Dosyayı görüntüle @
8fe40686
...
...
@@ -360,7 +360,8 @@ class Command(BaseCommand):
Check if the given path should be ignored or not.
"""
filename
=
os
.
path
.
basename
(
path
)
ignore
=
lambda
pattern
:
fnmatch
.
fnmatchcase
(
filename
,
pattern
)
ignore
=
lambda
pattern
:
(
fnmatch
.
fnmatchcase
(
filename
,
pattern
)
or
fnmatch
.
fnmatchcase
(
path
,
pattern
))
return
any
(
ignore
(
pattern
)
for
pattern
in
ignore_patterns
)
dir_suffix
=
'
%
s*'
%
os
.
sep
...
...
tests/i18n/commands/templates/subdir/ignored.html
0 → 100644
Dosyayı görüntüle @
8fe40686
{% load i18n %}
{% trans "This subdir should be ignored too." %}
tests/i18n/test_extraction.py
Dosyayı görüntüle @
8fe40686
...
...
@@ -360,35 +360,47 @@ class JavascriptExtractorTests(ExtractorTests):
class
IgnoredExtractorTests
(
ExtractorTests
):
def
test_ignore_option
(
self
):
def
_run_makemessages
(
self
,
**
options
):
os
.
chdir
(
self
.
test_dir
)
ignore_patterns
=
[
os
.
path
.
join
(
'ignore_dir'
,
'*'
),
'xxx_*'
,
]
stdout
=
StringIO
()
management
.
call_command
(
'makemessages'
,
locale
=
[
LOCALE
],
verbosity
=
2
,
ignore_patterns
=
ignore_patterns
,
stdout
=
stdout
)
stdout
=
stdout
,
**
options
)
data
=
stdout
.
getvalue
()
self
.
assertTrue
(
"ignoring directory ignore_dir"
in
data
)
self
.
assertTrue
(
"ignoring file xxx_ignored.html"
in
data
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
PO_FILE
))
with
open
(
self
.
PO_FILE
,
'r'
)
as
fp
:
po_contents
=
fp
.
read
()
self
.
assertMsgId
(
'This literal should be included.'
,
po_contents
)
self
.
assertNotMsgId
(
'This should be ignored.'
,
po_contents
)
self
.
assertNotMsgId
(
'This should be ignored too.'
,
po_contents
)
return
data
,
po_contents
def
test_ignore_directory
(
self
):
out
,
po_contents
=
self
.
_run_makemessages
(
ignore_patterns
=
[
os
.
path
.
join
(
'ignore_dir'
,
'*'
),
])
self
.
assertTrue
(
"ignoring directory ignore_dir"
in
out
)
self
.
assertMsgId
(
'This literal should be included.'
,
po_contents
)
self
.
assertNotMsgId
(
'This should be ignored.'
,
po_contents
)
def
test_ignore_subdirectory
(
self
):
out
,
po_contents
=
self
.
_run_makemessages
(
ignore_patterns
=
[
'templates/*/ignore.html'
,
'templates/subdir/*'
,
])
self
.
assertTrue
(
"ignoring directory subdir"
in
out
)
self
.
assertNotMsgId
(
'This subdir should be ignored too.'
,
po_contents
)
def
test_ignore_file_patterns
(
self
):
out
,
po_contents
=
self
.
_run_makemessages
(
ignore_patterns
=
[
'xxx_*'
,
])
self
.
assertTrue
(
"ignoring file xxx_ignored.html"
in
out
)
self
.
assertNotMsgId
(
'This should be ignored too.'
,
po_contents
)
@override_settings
(
STATIC_ROOT
=
os
.
path
.
join
(
this_directory
,
'commands'
,
'static_root/'
),
MEDIA_ROOT
=
os
.
path
.
join
(
this_directory
,
'commands'
,
'media_root/'
))
def
test_media_static_dirs_ignored
(
self
):
os
.
chdir
(
self
.
test_dir
)
stdout
=
StringIO
()
management
.
call_command
(
'makemessages'
,
locale
=
[
LOCALE
],
verbosity
=
2
,
stdout
=
stdout
)
data
=
stdout
.
getvalue
()
self
.
assertIn
(
"ignoring directory static_root"
,
data
)
self
.
assertIn
(
"ignoring directory media_root"
,
data
)
out
,
_
=
self
.
_run_makemessages
()
self
.
assertIn
(
"ignoring directory static_root"
,
out
)
self
.
assertIn
(
"ignoring directory media_root"
,
out
)
class
SymlinkExtractorTests
(
ExtractorTests
):
...
...
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