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
122c90a4
Kaydet (Commit)
122c90a4
authored
Eki 02, 2016
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27305 -- Removed BaseCommand.can_import_settings unused attribute
Thanks Tim Graham for the review.
üst
bae1160c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
3 additions
and
39 deletions
+3
-39
base.py
django/core/management/base.py
+0
-20
templates.py
django/core/management/templates.py
+0
-3
custom-management-commands.txt
docs/howto/custom-management-commands.txt
+0
-13
1.11.txt
docs/releases/1.11.txt
+2
-0
1.6.txt
docs/releases/1.6.txt
+1
-1
leave_locale_alone_false.py
..._commands/management/commands/leave_locale_alone_false.py
+0
-1
leave_locale_alone_true.py
...r_commands/management/commands/leave_locale_alone_true.py
+0
-1
No files found.
django/core/management/base.py
Dosyayı görüntüle @
122c90a4
...
@@ -151,12 +151,6 @@ class BaseCommand(object):
...
@@ -151,12 +151,6 @@ class BaseCommand(object):
Several attributes affect behavior at various steps along the way:
Several attributes affect behavior at various steps along the way:
``can_import_settings``
A boolean indicating whether the command needs to be able to
import Django settings; if ``True``, ``execute()`` will verify
that this is possible before proceeding. Default value is
``True``.
``help``
``help``
A short description of the command, which will be printed in
A short description of the command, which will be printed in
help messages.
help messages.
...
@@ -192,17 +186,12 @@ class BaseCommand(object):
...
@@ -192,17 +186,12 @@ class BaseCommand(object):
that is locale-sensitive and such content shouldn't contain any
that is locale-sensitive and such content shouldn't contain any
translations (like it happens e.g. with django.contrib.auth
translations (like it happens e.g. with django.contrib.auth
permissions) as activating any locale might cause unintended effects.
permissions) as activating any locale might cause unintended effects.
This option can't be False when the can_import_settings option is set
to False too because attempting to deactivate translations needs access
to settings. This condition will generate a CommandError.
"""
"""
# Metadata about this command.
# Metadata about this command.
help
=
''
help
=
''
# Configuration shortcuts that alter various logic.
# Configuration shortcuts that alter various logic.
_called_from_command_line
=
False
_called_from_command_line
=
False
can_import_settings
=
True
output_transaction
=
False
# Whether to wrap the output in a "BEGIN; COMMIT;"
output_transaction
=
False
# Whether to wrap the output in a "BEGIN; COMMIT;"
leave_locale_alone
=
False
leave_locale_alone
=
False
requires_migrations_checks
=
False
requires_migrations_checks
=
False
...
@@ -326,15 +315,6 @@ class BaseCommand(object):
...
@@ -326,15 +315,6 @@ class BaseCommand(object):
saved_locale
=
None
saved_locale
=
None
if
not
self
.
leave_locale_alone
:
if
not
self
.
leave_locale_alone
:
# Only mess with locales if we can assume we have a working
# settings file, because django.utils.translation requires settings
# (The final saying about whether the i18n machinery is active will be
# found in the value of the USE_I18N setting)
if
not
self
.
can_import_settings
:
raise
CommandError
(
"Incompatible values of 'leave_locale_alone' "
"(
%
s) and 'can_import_settings' (
%
s) command "
"options."
%
(
self
.
leave_locale_alone
,
self
.
can_import_settings
))
# Deactivate translations, because django-admin creates database
# Deactivate translations, because django-admin creates database
# content like permissions, and those shouldn't contain any
# content like permissions, and those shouldn't contain any
# translations.
# translations.
...
...
django/core/management/templates.py
Dosyayı görüntüle @
122c90a4
...
@@ -35,9 +35,6 @@ class TemplateCommand(BaseCommand):
...
@@ -35,9 +35,6 @@ class TemplateCommand(BaseCommand):
:param options: The additional variables passed to project or app templates
:param options: The additional variables passed to project or app templates
"""
"""
requires_system_checks
=
False
requires_system_checks
=
False
# Can't import settings during this command, because they haven't
# necessarily been created.
can_import_settings
=
False
# The supported URL schemes
# The supported URL schemes
url_schemes
=
[
'http'
,
'https'
,
'ftp'
]
url_schemes
=
[
'http'
,
'https'
,
'ftp'
]
# Can't perform any active locale changes during this command, because
# Can't perform any active locale changes during this command, because
...
...
docs/howto/custom-management-commands.txt
Dosyayı görüntüle @
122c90a4
...
@@ -148,7 +148,6 @@ support code::
...
@@ -148,7 +148,6 @@ support code::
class Command(BaseCommand):
class Command(BaseCommand):
...
...
can_import_settings = True
def handle(self, *args, **options):
def handle(self, *args, **options):
...
@@ -208,13 +207,6 @@ Attributes
...
@@ -208,13 +207,6 @@ Attributes
All attributes can be set in your derived class and can be used in
All attributes can be set in your derived class and can be used in
:class:`BaseCommand`’s :ref:`subclasses<ref-basecommand-subclasses>`.
:class:`BaseCommand`’s :ref:`subclasses<ref-basecommand-subclasses>`.
.. attribute:: BaseCommand.can_import_settings
A boolean indicating whether the command needs to be able to
import Django settings; if ``True``, ``execute()`` will verify
that this is possible before proceeding. Default value is
``True``.
.. attribute:: BaseCommand.help
.. attribute:: BaseCommand.help
A short description of the command, which will be printed in the
A short description of the command, which will be printed in the
...
@@ -261,11 +253,6 @@ All attributes can be set in your derived class and can be used in
...
@@ -261,11 +253,6 @@ All attributes can be set in your derived class and can be used in
effects. Seethe `Management commands and locales`_ section above for
effects. Seethe `Management commands and locales`_ section above for
further details.
further details.
This option can't be ``False`` when the
:data:`~BaseCommand.can_import_settings` option is set to ``False`` too
because attempting to set the locale needs access to settings. This
condition will generate a :exc:`CommandError`.
.. attribute:: BaseCommand.style
.. attribute:: BaseCommand.style
An instance attribute that helps create colored output when writing to
An instance attribute that helps create colored output when writing to
...
...
docs/releases/1.11.txt
Dosyayı görüntüle @
122c90a4
...
@@ -278,6 +278,8 @@ Management Commands
...
@@ -278,6 +278,8 @@ Management Commands
* The new :option:`loaddata --exclude` option allows excluding models and apps
* The new :option:`loaddata --exclude` option allows excluding models and apps
while loading data from fixtures.
while loading data from fixtures.
* The unused ``BaseCommand.can_import_settings`` attribute is removed.
Migrations
Migrations
~~~~~~~~~~
~~~~~~~~~~
...
...
docs/releases/1.6.txt
Dosyayı görüntüle @
122c90a4
...
@@ -189,7 +189,7 @@ Minor features
...
@@ -189,7 +189,7 @@ Minor features
* For custom management commands: Verification of the presence of valid
* For custom management commands: Verification of the presence of valid
settings in commands that ask for it by using the
settings in commands that ask for it by using the
:attr:`~django.core.management.BaseCommand.can_import_settings
` internal
``BaseCommand.can_import_settings`
` internal
option is now performed independently from handling of the locale that
option is now performed independently from handling of the locale that
should be active during the execution of the command. The latter can now be
should be active during the execution of the command. The latter can now be
influenced by the new
influenced by the new
...
...
tests/user_commands/management/commands/leave_locale_alone_false.py
Dosyayı görüntüle @
122c90a4
...
@@ -4,7 +4,6 @@ from django.utils import translation
...
@@ -4,7 +4,6 @@ from django.utils import translation
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
can_import_settings
=
True
leave_locale_alone
=
False
leave_locale_alone
=
False
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
...
...
tests/user_commands/management/commands/leave_locale_alone_true.py
Dosyayı görüntüle @
122c90a4
...
@@ -4,7 +4,6 @@ from django.utils import translation
...
@@ -4,7 +4,6 @@ from django.utils import translation
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
can_import_settings
=
True
leave_locale_alone
=
True
leave_locale_alone
=
True
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
...
...
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