Skip to content

Commit 90b2ff3

Browse files
committed
run checks
1 parent a2b273e commit 90b2ff3

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

oauth2_provider/apps.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
from django.apps import AppConfig, apps
2-
from django.core.exceptions import ImproperlyConfigured
3-
from django.db import router
1+
from django.apps import AppConfig
42

53

64
class DOTConfig(AppConfig):
75
name = "oauth2_provider"
86
verbose_name = "Django OAuth Toolkit"
97

10-
def _validate_token_configuration(self):
11-
from .settings import oauth2_settings
12-
13-
databases = set(
14-
router.db_for_write(apps.get_model(model))
15-
for model in (
16-
oauth2_settings.ACCESS_TOKEN_MODEL,
17-
oauth2_settings.ID_TOKEN_MODEL,
18-
oauth2_settings.REFRESH_TOKEN_MODEL,
19-
)
20-
)
21-
22-
# This is highly unlikely, but let's warn people just in case it does.
23-
# If the tokens were allowed to be in different databases this would require all
24-
# writes to have a transaction around each database. Instead, let's enforce that
25-
# they all live together in one database.
26-
# The tokens are not required to live in the default database provided the Django
27-
# routers know the correct database for them.
28-
if len(databases) > 1:
29-
raise ImproperlyConfigured("the token models are expected to be stored in the same database.")
30-
318
def ready(self):
32-
self._validate_token_configuration()
9+
# Import checks to ensure they run.
10+
from . import checks # noqa: F401

0 commit comments

Comments
 (0)