plain.oauth 0.21.0__tar.gz → 0.22.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/PKG-INFO +1 -1
  2. plain_oauth-0.22.0/plain/oauth/CHANGELOG.md +11 -0
  3. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/models.py +21 -24
  4. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/pyproject.toml +1 -1
  5. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/settings.py +3 -5
  6. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/test_checks.py +2 -2
  7. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/.gitignore +0 -0
  8. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/LICENSE +0 -0
  9. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/README.md +0 -0
  10. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/README.md +0 -0
  11. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/__init__.py +0 -0
  12. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/admin.py +0 -0
  13. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/config.py +0 -0
  14. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/default_settings.py +0 -0
  15. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/exceptions.py +0 -0
  16. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0001_initial.py +0 -0
  17. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0002_alter_oauthconnection_options_and_more.py +0 -0
  18. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0003_alter_oauthconnection_access_token_and_more.py +0 -0
  19. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0004_alter_oauthconnection_access_token_and_more.py +0 -0
  20. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0005_alter_oauthconnection_unique_together_and_more.py +0 -0
  21. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0006_remove_oauthconnection_unique_oauth_provider_user_id_and_more.py +0 -0
  22. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/0007_alter_oauthconnection_provider_key_and_more.py +0 -0
  23. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/migrations/__init__.py +0 -0
  24. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/providers.py +0 -0
  25. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/templates/oauth/callback.html +0 -0
  26. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/urls.py +0 -0
  27. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/plain/oauth/views.py +0 -0
  28. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/provider_examples/__init__.py +0 -0
  29. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/provider_examples/bitbucket.py +0 -0
  30. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/provider_examples/github.py +0 -0
  31. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/provider_examples/gitlab.py +0 -0
  32. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/templates/base.html +0 -0
  33. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/templates/index.html +0 -0
  34. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/templates/login.html +0 -0
  35. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/urls.py +0 -0
  36. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/users/migrations/0001_initial.py +0 -0
  37. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/users/migrations/__init__.py +0 -0
  38. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/app/users/models.py +0 -0
  39. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/provider_tests/__init__.py +0 -0
  40. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/provider_tests/test_github.py +0 -0
  41. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/providers/__init__.py +0 -0
  42. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/providers/bitbucket.py +0 -0
  43. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/providers/github.py +0 -0
  44. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/providers/gitlab.py +0 -0
  45. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/test_backends.py +0 -0
  46. {plain_oauth-0.21.0 → plain_oauth-0.22.0}/tests/test_providers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.21.0
3
+ Version: 0.22.0
4
4
  Summary: OAuth login and API access for Plain.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -0,0 +1,11 @@
1
+ # plain-oauth changelog
2
+
3
+ ## [0.22.0](https://github.com/dropseed/plain/releases/plain-oauth@0.22.0) (2025-06-23)
4
+
5
+ ### What's changed
6
+
7
+ - Updated `OAuthConnection.check()` to accept a single `database` argument instead of the older `databases` list, matching the new single `DATABASE` setting used across the Plain stack ([d346d81](https://github.com/dropseed/plain/commit/d346d81))
8
+
9
+ ### Upgrade instructions
10
+
11
+ - No changes required.
@@ -164,34 +164,31 @@ class OAuthConnection(models.Model):
164
164
  """
165
165
  errors = super().check(**kwargs)
166
166
 
167
- databases = kwargs.get("databases", None)
168
- if not databases:
167
+ database = kwargs.get("database", False)
168
+ if not database:
169
169
  return errors
170
170
 
171
171
  from .providers import get_provider_keys
172
172
 
173
- for database in databases:
174
- try:
175
- keys_in_db = set(
176
- cls.objects.using(database)
177
- .values_list("provider_key", flat=True)
178
- .distinct()
179
- )
180
- except (OperationalError, ProgrammingError):
181
- # Check runs on manage.py migrate, and the table may not exist yet
182
- # or it may not be installed on the particular database intentionally
183
- continue
184
-
185
- keys_in_settings = set(get_provider_keys())
186
-
187
- if keys_in_db - keys_in_settings:
188
- errors.append(
189
- Error(
190
- "The following OAuth providers are in the database but not in the settings: {}".format(
191
- ", ".join(keys_in_db - keys_in_settings)
192
- ),
193
- id="plain.oauth.E001",
194
- )
173
+ try:
174
+ keys_in_db = set(
175
+ cls.objects.values_list("provider_key", flat=True).distinct()
176
+ )
177
+ except (OperationalError, ProgrammingError):
178
+ # Check runs on manage.py migrate, and the table may not exist yet
179
+ # or it may not be installed on the particular database intentionally
180
+ return errors
181
+
182
+ keys_in_settings = set(get_provider_keys())
183
+
184
+ if keys_in_db - keys_in_settings:
185
+ errors.append(
186
+ Error(
187
+ "The following OAuth providers are in the database but not in the settings: {}".format(
188
+ ", ".join(keys_in_db - keys_in_settings)
189
+ ),
190
+ id="plain.oauth.E001",
195
191
  )
192
+ )
196
193
 
197
194
  return errors
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plain.oauth"
3
- version = "0.21.0"
3
+ version = "0.22.0"
4
4
  description = "OAuth login and API access for Plain."
5
5
  authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
6
6
  license = "BSD-3-Clause"
@@ -9,11 +9,9 @@ INSTALLED_PACKAGES = [
9
9
  "plain.oauth",
10
10
  "app.users",
11
11
  ]
12
- DATABASES = {
13
- "default": {
14
- "ENGINE": "plain.models.backends.sqlite3",
15
- "NAME": ":memory:",
16
- }
12
+ DATABASE = {
13
+ "ENGINE": "plain.models.backends.sqlite3",
14
+ "NAME": ":memory:",
17
15
  }
18
16
  MIDDLEWARE = [
19
17
  "plain.sessions.middleware.SessionMiddleware",
@@ -25,7 +25,7 @@ def test_oauth_provider_keys_check_pass(db, settings):
25
25
  access_token="test",
26
26
  )
27
27
 
28
- errors = OAuthConnection.check(databases=["default"])
28
+ errors = OAuthConnection.check(database=True)
29
29
  assert len(errors) == 0
30
30
 
31
31
 
@@ -58,7 +58,7 @@ def test_oauth_provider_keys_check_fail(db, settings):
58
58
  access_token="test",
59
59
  )
60
60
 
61
- errors = OAuthConnection.check(databases=["default"])
61
+ errors = OAuthConnection.check(database=True)
62
62
  assert len(errors) == 1
63
63
  assert (
64
64
  errors[0].msg
File without changes
File without changes
File without changes