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
395d75ea
Kaydet (Commit)
395d75ea
authored
Nis 10, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22194 -- Added --list-tags option to check command.
Thanks Elvard for the patch.
üst
b513fa5f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
2 deletions
+25
-2
registry.py
django/core/checks/registry.py
+4
-2
check.py
django/core/management/commands/check.py
+7
-0
django-admin.txt
docs/ref/django-admin.txt
+4
-0
tests.py
tests/check_framework/tests.py
+10
-0
No files found.
django/core/checks/registry.py
Dosyayı görüntüle @
395d75ea
...
@@ -64,8 +64,10 @@ class CheckRegistry(object):
...
@@ -64,8 +64,10 @@ class CheckRegistry(object):
return
errors
return
errors
def
tag_exists
(
self
,
tag
):
def
tag_exists
(
self
,
tag
):
tags
=
chain
(
*
[
check
.
tags
for
check
in
self
.
registered_checks
if
hasattr
(
check
,
'tags'
)])
return
tag
in
self
.
tags_available
()
return
tag
in
tags
def
tags_available
(
self
):
return
set
(
chain
(
*
[
check
.
tags
for
check
in
self
.
registered_checks
if
hasattr
(
check
,
'tags'
)]))
registry
=
CheckRegistry
()
registry
=
CheckRegistry
()
...
...
django/core/management/commands/check.py
Dosyayı görüntüle @
395d75ea
...
@@ -5,6 +5,7 @@ from optparse import make_option
...
@@ -5,6 +5,7 @@ from optparse import make_option
from
django.apps
import
apps
from
django.apps
import
apps
from
django.core
import
checks
from
django.core
import
checks
from
django.core.checks.registry
import
registry
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
...
@@ -16,9 +17,15 @@ class Command(BaseCommand):
...
@@ -16,9 +17,15 @@ class Command(BaseCommand):
option_list
=
BaseCommand
.
option_list
+
(
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'--tag'
,
'-t'
,
action
=
'append'
,
dest
=
'tags'
,
make_option
(
'--tag'
,
'-t'
,
action
=
'append'
,
dest
=
'tags'
,
help
=
'Run only checks labeled with given tag.'
),
help
=
'Run only checks labeled with given tag.'
),
make_option
(
'--list-tags'
,
action
=
'store_true'
,
dest
=
'list_tags'
,
help
=
'List available tags.'
),
)
)
def
handle
(
self
,
*
app_labels
,
**
options
):
def
handle
(
self
,
*
app_labels
,
**
options
):
if
options
.
get
(
'list_tags'
):
self
.
stdout
.
write
(
'
\n
'
.
join
(
sorted
(
registry
.
tags_available
())))
return
if
app_labels
:
if
app_labels
:
app_configs
=
[
apps
.
get_app_config
(
app_label
)
for
app_label
in
app_labels
]
app_configs
=
[
apps
.
get_app_config
(
app_label
)
for
app_label
in
app_labels
]
else
:
else
:
...
...
docs/ref/django-admin.txt
Dosyayı görüntüle @
395d75ea
...
@@ -126,6 +126,10 @@ to perform only security and compatibility checks, you would run::
...
@@ -126,6 +126,10 @@ to perform only security and compatibility checks, you would run::
python manage.py check --tag security --tag compatibility
python manage.py check --tag security --tag compatibility
.. django-admin-option:: --list-tags
List all available tags.
compilemessages
compilemessages
---------------
---------------
...
...
tests/check_framework/tests.py
Dosyayı görüntüle @
395d75ea
...
@@ -194,6 +194,16 @@ class CheckCommandTests(TestCase):
...
@@ -194,6 +194,16 @@ class CheckCommandTests(TestCase):
def
test_invalid_tag
(
self
):
def
test_invalid_tag
(
self
):
self
.
assertRaises
(
CommandError
,
call_command
,
'check'
,
tags
=
[
'missingtag'
])
self
.
assertRaises
(
CommandError
,
call_command
,
'check'
,
tags
=
[
'missingtag'
])
@override_system_checks
([
simple_system_check
])
def
test_list_tags_empty
(
self
):
call_command
(
'check'
,
list_tags
=
True
)
self
.
assertEqual
(
'
\n
'
,
sys
.
stdout
.
getvalue
())
@override_system_checks
([
tagged_system_check
])
def
test_list_tags
(
self
):
call_command
(
'check'
,
list_tags
=
True
)
self
.
assertEqual
(
'simpletag
\n
'
,
sys
.
stdout
.
getvalue
())
def
custom_error_system_check
(
app_configs
,
**
kwargs
):
def
custom_error_system_check
(
app_configs
,
**
kwargs
):
return
[
return
[
...
...
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