django-esi 5.3.0b1__tar.gz → 5.3.0b2__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.

Potentially problematic release.


This version of django-esi might be problematic. Click here for more details.

Files changed (76) hide show
  1. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/PKG-INFO +1 -1
  2. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/__init__.py +1 -1
  3. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/managers.py +12 -28
  4. django_esi-5.3.0b2/esi/tests/test_managers.py +673 -0
  5. django_esi-5.3.0b1/esi/tests/test_managers.py +0 -726
  6. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/LICENSE +0 -0
  7. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/README.md +0 -0
  8. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/admin.py +0 -0
  9. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/app_settings.py +0 -0
  10. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/apps.py +0 -0
  11. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/checks.py +0 -0
  12. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/clients.py +0 -0
  13. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/decorators.py +0 -0
  14. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/errors.py +0 -0
  15. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/de/LC_MESSAGES/django.mo +0 -0
  16. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/de/LC_MESSAGES/django.po +0 -0
  17. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/en/LC_MESSAGES/django.mo +0 -0
  18. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/en/LC_MESSAGES/django.po +0 -0
  19. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/es/LC_MESSAGES/django.mo +0 -0
  20. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/es/LC_MESSAGES/django.po +0 -0
  21. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
  22. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/fr_FR/LC_MESSAGES/django.po +0 -0
  23. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/it_IT/LC_MESSAGES/django.mo +0 -0
  24. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/it_IT/LC_MESSAGES/django.po +0 -0
  25. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/ja/LC_MESSAGES/django.mo +0 -0
  26. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/ja/LC_MESSAGES/django.po +0 -0
  27. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
  28. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/ko_KR/LC_MESSAGES/django.po +0 -0
  29. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/ru/LC_MESSAGES/django.mo +0 -0
  30. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/ru/LC_MESSAGES/django.po +0 -0
  31. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  32. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/locale/zh_Hans/LC_MESSAGES/django.po +0 -0
  33. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/management/commands/__init__.py +0 -0
  34. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/management/commands/migrate_to_ssov2.py +0 -0
  35. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0001_initial.py +0 -0
  36. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0002_scopes_20161208.py +0 -0
  37. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0003_hide_tokens_from_admin_site.py +0 -0
  38. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0004_remove_unique_access_token.py +0 -0
  39. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0005_remove_token_length_limit.py +0 -0
  40. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0006_remove_url_length_limit.py +0 -0
  41. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0007_fix_mysql_8_migration.py +0 -0
  42. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0008_nullable_refresh_token.py +0 -0
  43. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0009_set_old_tokens_to_sso_v1.py +0 -0
  44. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0010_set_new_tokens_to_sso_v2.py +0 -0
  45. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0011_add_token_indices.py +0 -0
  46. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/0012_fix_token_type_choices.py +0 -0
  47. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/migrations/__init__.py +0 -0
  48. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/models.py +0 -0
  49. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/static/esi/img/EVE_SSO_Login_Buttons_Large_Black.png +0 -0
  50. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/static/esi/img/EVE_SSO_Login_Buttons_Large_White.png +0 -0
  51. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/static/esi/img/EVE_SSO_Login_Buttons_Small_Black.png +0 -0
  52. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/static/esi/img/EVE_SSO_Login_Buttons_Small_White.png +0 -0
  53. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tasks.py +0 -0
  54. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/templates/esi/select_token.html +0 -0
  55. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/templatetags/__init__.py +0 -0
  56. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/templatetags/scope_tags.py +0 -0
  57. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/__init__.py +0 -0
  58. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/client_authed_pilot.py +0 -0
  59. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/client_public_pilot.py +0 -0
  60. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/factories.py +0 -0
  61. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/factories_2.py +0 -0
  62. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/jwt_factory.py +0 -0
  63. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_checks.py +0 -0
  64. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_clients.py +0 -0
  65. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_decorators.py +0 -0
  66. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_management_command.py +0 -0
  67. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_models.py +0 -0
  68. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_swagger.json +0 -0
  69. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_swagger_full.json +0 -0
  70. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_tasks.py +0 -0
  71. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_templatetags.py +0 -0
  72. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/test_views.py +0 -0
  73. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/tests/threading_pilot.py +0 -0
  74. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/urls.py +0 -0
  75. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/esi/views.py +0 -0
  76. {django_esi-5.3.0b1 → django_esi-5.3.0b2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-esi
3
- Version: 5.3.0b1
3
+ Version: 5.3.0b2
4
4
  Summary: Django app for accessing the EVE Swagger Interface (ESI).
5
5
  Author-email: Alliance Auth <adarnof@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -2,5 +2,5 @@
2
2
 
3
3
  default_app_config = 'esi.apps.EsiConfig'
4
4
 
5
- __version__ = '5.3.0b1'
5
+ __version__ = '5.3.0b2'
6
6
  __title__ = 'django-esi'
@@ -1,18 +1,16 @@
1
- from datetime import timedelta
2
1
  import logging
3
- from typing import Union, Any
2
+ from datetime import timedelta
3
+ from typing import Any, Union
4
4
 
5
5
  import requests
6
- from requests_oauthlib import OAuth2Session
7
-
8
6
  from django.db import models
9
7
  from django.utils import timezone
10
-
11
- from .errors import TokenError, IncompleteResponseError
12
- from . import app_settings
13
-
14
8
  from jose import jwt
15
9
  from jose.exceptions import ExpiredSignatureError, JWTError
10
+ from requests_oauthlib import OAuth2Session
11
+
12
+ from . import app_settings
13
+ from .errors import IncompleteResponseError, TokenError
16
14
 
17
15
  logger = logging.getLogger(__name__)
18
16
 
@@ -75,26 +73,12 @@ class TokenQueryset(models.QuerySet):
75
73
  Returns:
76
74
  All tokens which are still valid.
77
75
  """
78
- expired = self.get_expired()
79
- valid = list(
80
- self.exclude(
81
- pk__in=expired
82
- ).values_list(
83
- "pk",
84
- flat=True
85
- )
86
- )
87
- valid_expired = list(
88
- expired.bulk_refresh(
89
- ).values_list(
90
- "pk",
91
- flat=True
92
- )
93
- )
94
- _qs = self.filter(
95
- pk__in=(valid + valid_expired)
96
- )
97
- return _qs
76
+ expired_pks = set(self.get_expired().values_list("pk", flat=True))
77
+ fresh_pks = set(self.exclude(pk__in=expired_pks).values_list("pk", flat=True))
78
+ refreshed = self.filter(pk__in=expired_pks).bulk_refresh()
79
+ refreshed_pks = set(refreshed.values_list("pk", flat=True))
80
+ qs = self.filter(pk__in=fresh_pks | refreshed_pks)
81
+ return qs
98
82
 
99
83
  def require_scopes(self, scope_string: Union[str, list]) -> models.QuerySet:
100
84
  """Filter tokens which have at least a subset of given scopes.