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
a7add2f2
Kaydet (Commit)
a7add2f2
authored
Ara 27, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Migrated built-in AppCommands to use handle_app_config.
üst
bb8ec71f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
26 deletions
+51
-26
sql.py
django/core/management/commands/sql.py
+6
-2
sqlall.py
django/core/management/commands/sqlall.py
+6
-2
sqlclear.py
django/core/management/commands/sqlclear.py
+6
-2
sqlcustom.py
django/core/management/commands/sqlcustom.py
+6
-2
sqldropindexes.py
django/core/management/commands/sqldropindexes.py
+6
-2
sqlindexes.py
django/core/management/commands/sqlindexes.py
+6
-2
sqlsequencereset.py
django/core/management/commands/sqlsequencereset.py
+6
-2
app_command.py
tests/admin_scripts/management/commands/app_command.py
+2
-2
tests.py
tests/admin_scripts/tests.py
+7
-10
No files found.
django/core/management/commands/sql.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -18,5 +18,9 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
return
'
\n
'
.
join
(
sql_create
(
app
,
self
.
style
,
connections
[
options
.
get
(
'database'
)]))
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
statements
=
sql_create
(
app_config
.
models_module
,
self
.
style
,
connection
)
return
'
\n
'
.
join
(
statements
)
django/core/management/commands/sqlall.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -18,5 +18,9 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
return
'
\n
'
.
join
(
sql_all
(
app
,
self
.
style
,
connections
[
options
.
get
(
'database'
)]))
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
statements
=
sql_all
(
app_config
.
models_module
,
self
.
style
,
connection
)
return
'
\n
'
.
join
(
statements
)
django/core/management/commands/sqlclear.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -18,5 +18,9 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
return
'
\n
'
.
join
(
sql_delete
(
app
,
self
.
style
,
connections
[
options
.
get
(
'database'
)]))
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
statements
=
sql_delete
(
app_config
.
models_module
,
self
.
style
,
connection
)
return
'
\n
'
.
join
(
statements
)
django/core/management/commands/sqlcustom.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -18,5 +18,9 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
return
'
\n
'
.
join
(
sql_custom
(
app
,
self
.
style
,
connections
[
options
.
get
(
'database'
)]))
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
statements
=
sql_custom
(
app_config
.
models_module
,
self
.
style
,
connection
)
return
'
\n
'
.
join
(
statements
)
django/core/management/commands/sqldropindexes.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -19,5 +19,9 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
return
'
\n
'
.
join
(
sql_destroy_indexes
(
app
,
self
.
style
,
connections
[
options
.
get
(
'database'
)]))
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
statements
=
sql_destroy_indexes
(
app_config
.
models_module
,
self
.
style
,
connection
)
return
'
\n
'
.
join
(
statements
)
django/core/management/commands/sqlindexes.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -19,5 +19,9 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
return
'
\n
'
.
join
(
sql_indexes
(
app
,
self
.
style
,
connections
[
options
.
get
(
'database'
)]))
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
statements
=
sql_indexes
(
app_config
.
models_module
,
self
.
style
,
connection
)
return
'
\n
'
.
join
(
statements
)
django/core/management/commands/sqlsequencereset.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -19,6 +19,10 @@ class Command(AppCommand):
output_transaction
=
True
def
handle_app
(
self
,
app
,
**
options
):
def
handle_app_config
(
self
,
app_config
,
**
options
):
if
app_config
.
models_module
is
None
:
return
connection
=
connections
[
options
.
get
(
'database'
)]
return
'
\n
'
.
join
(
connection
.
ops
.
sequence_reset_sql
(
self
.
style
,
apps
.
get_models
(
app
,
include_auto_created
=
True
)))
models
=
apps
.
get_models
(
app_config
.
models_module
,
include_auto_created
=
True
)
statements
=
connection
.
ops
.
sequence_reset_sql
(
self
.
style
,
models
)
return
'
\n
'
.
join
(
statements
)
tests/admin_scripts/management/commands/app_command.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -6,5 +6,5 @@ class Command(AppCommand):
requires_model_validation
=
False
args
=
'[appname ...]'
def
handle_app
(
self
,
app
,
**
options
):
print
(
'EXECUTE:AppCommand
app=
%
s, options=
%
s'
%
(
app
,
sorted
(
options
.
items
())))
def
handle_app
_config
(
self
,
app_config
,
**
options
):
print
(
'EXECUTE:AppCommand
name=
%
s, options=
%
s'
%
(
app_config
.
name
,
sorted
(
options
.
items
())))
tests/admin_scripts/tests.py
Dosyayı görüntüle @
a7add2f2
...
...
@@ -1416,27 +1416,24 @@ class CommandTypes(AdminScriptTestCase):
args
=
[
'app_command'
,
'auth'
]
out
,
err
=
self
.
run_manage
(
args
)
self
.
assertNoOutput
(
err
)
self
.
assertOutput
(
out
,
"EXECUTE:AppCommand app=<module 'django.contrib.auth.models'"
)
self
.
assertOutput
(
out
,
"module 'django.contrib.auth.models' from"
)
self
.
assertOutput
(
out
,
str_prefix
(
"'>, options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity',
%(_)
s'1')]"
))
self
.
assertOutput
(
out
,
"EXECUTE:AppCommand name=django.contrib.auth, options="
)
self
.
assertOutput
(
out
,
str_prefix
(
", options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity',
%(_)
s'1')]"
))
def
test_app_command_no_apps
(
self
):
"User AppCommands raise an error when no app name is provided"
args
=
[
'app_command'
]
out
,
err
=
self
.
run_manage
(
args
)
self
.
assertOutput
(
err
,
'Error: Enter at least one app
name
.'
)
self
.
assertOutput
(
err
,
'Error: Enter at least one app
lication label
.'
)
def
test_app_command_multiple_apps
(
self
):
"User AppCommands raise an error when multiple app names are provided"
args
=
[
'app_command'
,
'auth'
,
'contenttypes'
]
out
,
err
=
self
.
run_manage
(
args
)
self
.
assertNoOutput
(
err
)
self
.
assertOutput
(
out
,
"EXECUTE:AppCommand app=<module 'django.contrib.auth.models'"
)
self
.
assertOutput
(
out
,
"module 'django.contrib.auth.models' from"
)
self
.
assertOutput
(
out
,
str_prefix
(
"'>, options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity',
%(_)
s'1')]"
))
self
.
assertOutput
(
out
,
"EXECUTE:AppCommand app=<module 'django.contrib.contenttypes.models'"
)
self
.
assertOutput
(
out
,
"module 'django.contrib.contenttypes.models' from"
)
self
.
assertOutput
(
out
,
str_prefix
(
"'>, options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity',
%(_)
s'1')]"
))
self
.
assertOutput
(
out
,
"EXECUTE:AppCommand name=django.contrib.auth, options="
)
self
.
assertOutput
(
out
,
str_prefix
(
", options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity',
%(_)
s'1')]"
))
self
.
assertOutput
(
out
,
"EXECUTE:AppCommand name=django.contrib.contenttypes, options="
)
self
.
assertOutput
(
out
,
str_prefix
(
", options=[('no_color', False), ('pythonpath', None), ('settings', None), ('traceback', None), ('verbosity',
%(_)
s'1')]"
))
def
test_app_command_invalid_appname
(
self
):
"User AppCommands can execute when a single app name is provided"
...
...
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