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
efeceba5
Unverified
Kaydet (Commit)
efeceba5
authored
Nis 04, 2019
tarafından
Aarni Koskela
Kaydeden (comit)
Mariusz Felisiak
Nis 26, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #30312 -- Relaxed admin check from django.contrib.sessions to SessionMiddleware subclasses.
üst
85676979
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
11 deletions
+28
-11
checks.py
django/contrib/admin/checks.py
+6
-1
checks.txt
docs/ref/checks.txt
+2
-2
2.2.1.txt
docs/releases/2.2.1.txt
+6
-0
tests.py
tests/admin_checks/tests.py
+13
-7
tests.py
tests/admin_scripts/tests.py
+1
-1
No files found.
django/contrib/admin/checks.py
Dosyayı görüntüle @
efeceba5
...
@@ -65,7 +65,6 @@ def check_dependencies(**kwargs):
...
@@ -65,7 +65,6 @@ def check_dependencies(**kwargs):
(
'django.contrib.contenttypes'
,
401
),
(
'django.contrib.contenttypes'
,
401
),
(
'django.contrib.auth'
,
405
),
(
'django.contrib.auth'
,
405
),
(
'django.contrib.messages'
,
406
),
(
'django.contrib.messages'
,
406
),
(
'django.contrib.sessions'
,
407
),
)
)
for
app_name
,
error_code
in
app_dependencies
:
for
app_name
,
error_code
in
app_dependencies
:
if
not
apps
.
is_installed
(
app_name
):
if
not
apps
.
is_installed
(
app_name
):
...
@@ -118,6 +117,12 @@ def check_dependencies(**kwargs):
...
@@ -118,6 +117,12 @@ def check_dependencies(**kwargs):
"be in MIDDLEWARE in order to use the admin application."
,
"be in MIDDLEWARE in order to use the admin application."
,
id
=
'admin.E409'
,
id
=
'admin.E409'
,
))
))
if
not
_contains_subclass
(
'django.contrib.sessions.middleware.SessionMiddleware'
,
settings
.
MIDDLEWARE
):
errors
.
append
(
checks
.
Error
(
"'django.contrib.sessions.middleware.SessionMiddleware' must "
"be in MIDDLEWARE in order to use the admin application."
,
id
=
'admin.E410'
,
))
return
errors
return
errors
...
...
docs/ref/checks.txt
Dosyayı görüntüle @
efeceba5
...
@@ -666,13 +666,13 @@ The following checks are performed on the default
...
@@ -666,13 +666,13 @@ The following checks are performed on the default
:setting:`INSTALLED_APPS` in order to use the admin application.
:setting:`INSTALLED_APPS` in order to use the admin application.
* **admin.E406**: :mod:`django.contrib.messages` must be in
* **admin.E406**: :mod:`django.contrib.messages` must be in
:setting:`INSTALLED_APPS` in order to use the admin application.
:setting:`INSTALLED_APPS` in order to use the admin application.
* **admin.E407**: :mod:`django.contrib.sessions` must be in
:setting:`INSTALLED_APPS` in order to use the admin application.
* **admin.E408**:
* **admin.E408**:
:class:`django.contrib.auth.middleware.AuthenticationMiddleware` must be in
:class:`django.contrib.auth.middleware.AuthenticationMiddleware` must be in
:setting:`MIDDLEWARE` in order to use the admin application.
:setting:`MIDDLEWARE` in order to use the admin application.
* **admin.E409**: :class:`django.contrib.messages.middleware.MessageMiddleware`
* **admin.E409**: :class:`django.contrib.messages.middleware.MessageMiddleware`
must be in :setting:`MIDDLEWARE` in order to use the admin application.
must be in :setting:`MIDDLEWARE` in order to use the admin application.
* **admin.E410**: :class:`django.contrib.sessions.middleware.SessionMiddleware`
must be in :setting:`MIDDLEWARE` in order to use the admin application.
``auth``
``auth``
--------
--------
...
...
docs/releases/2.2.1.txt
Dosyayı görüntüle @
efeceba5
...
@@ -49,3 +49,9 @@ Bugfixes
...
@@ -49,3 +49,9 @@ Bugfixes
* Fixed a regression in Django 2.2 that caused an exception to be raised when
* Fixed a regression in Django 2.2 that caused an exception to be raised when
a custom error handler could not be imported (:ticket:`30318`).
a custom error handler could not be imported (:ticket:`30318`).
* Relaxed the system check added in Django 2.2 for the admin app's dependencies
to reallow use of
:class:`~django.contrib.sessions.middleware.SessionMiddleware` subclasses,
rather than requiring :mod:`django.contrib.sessions` to be in
:setting:`INSTALLED_APPS` (:ticket:`30312`).
tests/admin_checks/tests.py
Dosyayı görüntüle @
efeceba5
...
@@ -5,6 +5,7 @@ from django.contrib.auth.backends import ModelBackend
...
@@ -5,6 +5,7 @@ from django.contrib.auth.backends import ModelBackend
from
django.contrib.auth.middleware
import
AuthenticationMiddleware
from
django.contrib.auth.middleware
import
AuthenticationMiddleware
from
django.contrib.contenttypes.admin
import
GenericStackedInline
from
django.contrib.contenttypes.admin
import
GenericStackedInline
from
django.contrib.messages.middleware
import
MessageMiddleware
from
django.contrib.messages.middleware
import
MessageMiddleware
from
django.contrib.sessions.middleware
import
SessionMiddleware
from
django.core
import
checks
from
django.core
import
checks
from
django.test
import
SimpleTestCase
,
override_settings
from
django.test
import
SimpleTestCase
,
override_settings
...
@@ -52,13 +53,16 @@ class ModelBackendSubclass(ModelBackend):
...
@@ -52,13 +53,16 @@ class ModelBackendSubclass(ModelBackend):
pass
pass
class
SessionMiddlewareSubclass
(
SessionMiddleware
):
pass
@override_settings
(
@override_settings
(
SILENCED_SYSTEM_CHECKS
=
[
'fields.W342'
],
# ForeignKey(unique=True)
SILENCED_SYSTEM_CHECKS
=
[
'fields.W342'
],
# ForeignKey(unique=True)
INSTALLED_APPS
=
[
INSTALLED_APPS
=
[
'django.contrib.admin'
,
'django.contrib.admin'
,
'django.contrib.auth'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
'django.contrib.contenttypes'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'admin_checks'
,
'admin_checks'
,
],
],
...
@@ -93,11 +97,6 @@ class SystemChecksTestCase(SimpleTestCase):
...
@@ -93,11 +97,6 @@ class SystemChecksTestCase(SimpleTestCase):
"to use the admin application."
,
"to use the admin application."
,
id
=
'admin.E406'
,
id
=
'admin.E406'
,
),
),
checks
.
Error
(
"'django.contrib.sessions' must be in INSTALLED_APPS in order "
"to use the admin application."
,
id
=
'admin.E407'
,
)
]
]
self
.
assertEqual
(
errors
,
expected
)
self
.
assertEqual
(
errors
,
expected
)
...
@@ -201,13 +200,19 @@ class SystemChecksTestCase(SimpleTestCase):
...
@@ -201,13 +200,19 @@ class SystemChecksTestCase(SimpleTestCase):
"'django.contrib.messages.middleware.MessageMiddleware' "
"'django.contrib.messages.middleware.MessageMiddleware' "
"must be in MIDDLEWARE in order to use the admin application."
,
"must be in MIDDLEWARE in order to use the admin application."
,
id
=
'admin.E409'
,
id
=
'admin.E409'
,
)
),
checks
.
Error
(
"'django.contrib.sessions.middleware.SessionMiddleware' "
"must be in MIDDLEWARE in order to use the admin application."
,
id
=
'admin.E410'
,
),
]
]
self
.
assertEqual
(
errors
,
expected
)
self
.
assertEqual
(
errors
,
expected
)
@override_settings
(
MIDDLEWARE
=
[
@override_settings
(
MIDDLEWARE
=
[
'admin_checks.tests.AuthenticationMiddlewareSubclass'
,
'admin_checks.tests.AuthenticationMiddlewareSubclass'
,
'admin_checks.tests.MessageMiddlewareSubclass'
,
'admin_checks.tests.MessageMiddlewareSubclass'
,
'admin_checks.tests.SessionMiddlewareSubclass'
,
])
])
def
test_middleware_subclasses
(
self
):
def
test_middleware_subclasses
(
self
):
self
.
assertEqual
(
admin
.
checks
.
check_dependencies
(),
[])
self
.
assertEqual
(
admin
.
checks
.
check_dependencies
(),
[])
...
@@ -216,6 +221,7 @@ class SystemChecksTestCase(SimpleTestCase):
...
@@ -216,6 +221,7 @@ class SystemChecksTestCase(SimpleTestCase):
'django.contrib.does.not.Exist'
,
'django.contrib.does.not.Exist'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
])
])
def
test_admin_check_ignores_import_error_in_middleware
(
self
):
def
test_admin_check_ignores_import_error_in_middleware
(
self
):
self
.
assertEqual
(
admin
.
checks
.
check_dependencies
(),
[])
self
.
assertEqual
(
admin
.
checks
.
check_dependencies
(),
[])
...
...
tests/admin_scripts/tests.py
Dosyayı görüntüle @
efeceba5
...
@@ -1103,13 +1103,13 @@ class ManageCheck(AdminScriptTestCase):
...
@@ -1103,13 +1103,13 @@ class ManageCheck(AdminScriptTestCase):
'django.contrib.auth'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
'django.contrib.contenttypes'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'django.contrib.sessions'
,
],
],
sdict
=
{
sdict
=
{
'DEBUG'
:
True
,
'DEBUG'
:
True
,
'MIDDLEWARE'
:
[
'MIDDLEWARE'
:
[
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
],
],
'TEMPLATES'
:
[
'TEMPLATES'
:
[
{
{
...
...
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