squad 1.85__py3-none-any.whl → 1.86.3__py3-none-any.whl
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 squad might be problematic. Click here for more details.
- squad/api/__init__.py +40 -0
- squad/api/rest.py +1 -0
- squad/ci/backend/tuxsuite.py +6 -0
- squad/settings.py +8 -11
- squad/version.py +1 -1
- {squad-1.85.dist-info → squad-1.86.3.dist-info}/METADATA +1 -1
- {squad-1.85.dist-info → squad-1.86.3.dist-info}/RECORD +11 -11
- {squad-1.85.dist-info → squad-1.86.3.dist-info}/COPYING +0 -0
- {squad-1.85.dist-info → squad-1.86.3.dist-info}/WHEEL +0 -0
- {squad-1.85.dist-info → squad-1.86.3.dist-info}/entry_points.txt +0 -0
- {squad-1.85.dist-info → squad-1.86.3.dist-info}/top_level.txt +0 -0
squad/api/__init__.py
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
from django.core.cache import cache
|
2
|
+
from rest_framework.throttling import UserRateThrottle
|
3
|
+
|
4
|
+
|
5
|
+
class SocialUserRateThrottle(UserRateThrottle):
|
6
|
+
"""
|
7
|
+
Limits the rate of API calls that may be made by a given social user.
|
8
|
+
|
9
|
+
The user id will be used as a unique cache key if the user is
|
10
|
+
authenticated. For anonymous requests, the IP address of the request will
|
11
|
+
be used.
|
12
|
+
"""
|
13
|
+
|
14
|
+
scope = "socialuser"
|
15
|
+
|
16
|
+
def is_social_user(self, user):
|
17
|
+
"""
|
18
|
+
Social account user might use multiple applications (github, gitlab, google, ...)
|
19
|
+
to log in. But all of the login applications would likely point to the same
|
20
|
+
django user, which is what we want to rate limit here.
|
21
|
+
"""
|
22
|
+
|
23
|
+
key = f"socialuser#{user.id}"
|
24
|
+
from allauth.socialaccount.models import SocialAccount
|
25
|
+
return cache.get_or_set(key, SocialAccount.objects.filter(user_id=user.id).exists())
|
26
|
+
|
27
|
+
def get_cache_key(self, request, view):
|
28
|
+
if request.user and request.user.is_authenticated:
|
29
|
+
if not self.is_social_user(request.user):
|
30
|
+
# do not throttle non-social users
|
31
|
+
return None
|
32
|
+
|
33
|
+
ident = request.user.pk
|
34
|
+
else:
|
35
|
+
ident = self.get_ident(request)
|
36
|
+
|
37
|
+
return self.cache_format % {
|
38
|
+
"scope": self.scope,
|
39
|
+
"ident": ident
|
40
|
+
}
|
squad/api/rest.py
CHANGED
@@ -173,6 +173,7 @@ class TestJobFilter(filters.FilterSet):
|
|
173
173
|
"fetched": ['exact', 'in'],
|
174
174
|
"fetch_attempts": ['exact', 'in'],
|
175
175
|
"last_fetch_attempt": ['exact', 'in', 'lt', 'gt', 'lte', 'gte'],
|
176
|
+
"created_at": ['exact', 'in', 'lt', 'gt', 'lte', 'gte'],
|
176
177
|
"failure": ['exact', 'in', 'startswith', 'contains', 'icontains'],
|
177
178
|
"can_resubmit": ['exact', 'in'],
|
178
179
|
"resubmitted_count": ['exact', 'in'],
|
squad/ci/backend/tuxsuite.py
CHANGED
@@ -419,6 +419,12 @@ class Backend(BaseBackend):
|
|
419
419
|
endpoint = f'groups/{tux_group}/projects/{tux_user}/{result_type.lower()}s/{tux_uid}/cancel'
|
420
420
|
url = urljoin(self.data.url, endpoint)
|
421
421
|
response = requests.post(url)
|
422
|
+
|
423
|
+
testjob.fetched = True
|
424
|
+
testjob.submitted = True
|
425
|
+
testjob.job_status = "Canceled"
|
426
|
+
testjob.save()
|
427
|
+
|
422
428
|
return response.status_code == 200
|
423
429
|
|
424
430
|
def supports_callbacks(self):
|
squad/settings.py
CHANGED
@@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
|
|
13
13
|
from celery.schedules import crontab
|
14
14
|
from django.conf import global_settings
|
15
15
|
from email.utils import parseaddr
|
16
|
+
from importlib.util import find_spec
|
16
17
|
from glob import glob
|
17
18
|
import contextlib
|
18
19
|
import json
|
@@ -55,30 +56,23 @@ ALLOWED_HOSTS = ['*']
|
|
55
56
|
|
56
57
|
# Application definition
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
imp.find_module('django_extensions')
|
59
|
+
django_extensions = None
|
60
|
+
if find_spec('django_extensions'):
|
61
61
|
django_extensions = 'django_extensions'
|
62
|
-
except ImportError:
|
63
|
-
django_extensions = None
|
64
62
|
|
65
63
|
django_toolbar = None
|
66
64
|
django_toolbar_middleware = None
|
67
|
-
|
68
|
-
|
65
|
+
django_toolbar_module_spec = find_spec('debug_toolbar')
|
66
|
+
if django_toolbar_module_spec:
|
69
67
|
DEBUG_TOOLBAR_CONFIG = {
|
70
68
|
'JQUERY_URL': '',
|
71
69
|
'SHOW_COLLAPSED': True,
|
72
70
|
'SHOW_TOOLBAR_CALLBACK': 'squad.frontend.utils.show_debug_toolbar',
|
73
71
|
}
|
74
72
|
|
75
|
-
import imp
|
76
|
-
imp.find_module('debug_toolbar')
|
77
73
|
django_toolbar = 'debug_toolbar'
|
78
74
|
django_toolbar_middleware = 'debug_toolbar.middleware.DebugToolbarMiddleware'
|
79
75
|
INTERNAL_IPS = ['127.0.0.1']
|
80
|
-
except ImportError:
|
81
|
-
pass
|
82
76
|
|
83
77
|
|
84
78
|
django_allauth_middleware = None
|
@@ -445,6 +439,9 @@ if SENTRY_DSN:
|
|
445
439
|
# Django's default is 2.5MB, which is a bit low
|
446
440
|
DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760 # 10MB
|
447
441
|
|
442
|
+
# Django requires that this specification is present in settings.py
|
443
|
+
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
444
|
+
|
448
445
|
try:
|
449
446
|
from squad.local_settings import * # noqa: F401,F403
|
450
447
|
except ImportError:
|
squad/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '1.
|
1
|
+
__version__ = '1.86.3'
|
@@ -7,17 +7,17 @@ squad/http.py,sha256=KuIKtpf3yOvf5fwc0T2MR0ul1l4AKxq3b0CLdk6KBhM,3667
|
|
7
7
|
squad/jinja2.py,sha256=OKX-lzNz6qtTZL56HWv4UBMPuBl4WQXv0qFJztGp9zs,2541
|
8
8
|
squad/mail.py,sha256=xH5wuIpD7u1fTN9vNOcbzByojleaffsKwp-9i3BeOD0,390
|
9
9
|
squad/manage.py,sha256=Z-LXT67p0R-IzwJ9fLIAacEZmU0VUjqDOSg7j2ZSxJ4,1437
|
10
|
-
squad/settings.py,sha256=
|
10
|
+
squad/settings.py,sha256=YB2g6mHaa4sct04u7DHGr_RSLugxMTDGaMnZl69Yp7o,14652
|
11
11
|
squad/socialaccount.py,sha256=vySqPwQ3qVVpahuJ-Snln8K--yzRL3bw4Nx27AsB39A,789
|
12
12
|
squad/urls.py,sha256=JiEfVW8YlzLPE52c2aHzdn5kVVKK4o22w8h5KOA6QhQ,2776
|
13
|
-
squad/version.py,sha256=
|
13
|
+
squad/version.py,sha256=Zroio3ZOXQsWya00gzHIk2KPUahZ7osQXHfabhsnwPw,23
|
14
14
|
squad/wsgi.py,sha256=SF8T0cQ0OPVyuYjO5YXBIQzvSXQHV0M2BTmd4gP1rPs,387
|
15
|
-
squad/api/__init__.py,sha256=
|
15
|
+
squad/api/__init__.py,sha256=CJiVakfAlHVN5mIFRVQYZQfuNUhUgWVbsdYTME4tq7U,1349
|
16
16
|
squad/api/apps.py,sha256=Trk72p-iV1uGn0o5mdJn5HARUoHGbfgO49jwXvpkmdQ,141
|
17
17
|
squad/api/ci.py,sha256=ymG-eMKXpJgrVUiZcqJW-dYZQKvm1LkdR3TUMe4OSoM,6943
|
18
18
|
squad/api/data.py,sha256=obKDV0-neEvj5lPF9VED2gy_hpfhGtLJABYvSY38ing,2379
|
19
19
|
squad/api/filters.py,sha256=Zvp8DCJmiNquFWqvfVseEAAMYYPiT95RUjqKdzcqSnw,6917
|
20
|
-
squad/api/rest.py,sha256=
|
20
|
+
squad/api/rest.py,sha256=X3WX6tkqWl2H59fCJCNc3NIEkP4GoXImQLyCmvUlrMQ,77172
|
21
21
|
squad/api/urls.py,sha256=rmsdaL1uOCVSZ5x1redup9RliICmijaBjRK5ObsTkG8,1343
|
22
22
|
squad/api/utils.py,sha256=Sa8QFId3_oSqD2UOoY3Kuh54LLDLPNMq2sub5ktd6Fs,1160
|
23
23
|
squad/api/views.py,sha256=kuFlbiyZiD0i9jwwmkL3Y22LwJ3bx2oJs28d1g2DPA0,3898
|
@@ -32,7 +32,7 @@ squad/ci/backend/__init__.py,sha256=yhpotXT9F4IdAOXvGQ3-17eOHAFwoaqf9SnMX17ab30,
|
|
32
32
|
squad/ci/backend/fake.py,sha256=9sPKndsGd5GDNPp35v-zfJWXZCbge-yXH3RBQGgTlPk,2340
|
33
33
|
squad/ci/backend/lava.py,sha256=EXwEksjdOi_ZrUoMkBTyxVjqVOnJvEFNg_LWqUKaIgA,33607
|
34
34
|
squad/ci/backend/null.py,sha256=0CVylWELIZw3JyzCROB4XXAjgQUi15YjQz5caRfTNBo,5434
|
35
|
-
squad/ci/backend/tuxsuite.py,sha256=
|
35
|
+
squad/ci/backend/tuxsuite.py,sha256=Gq4cbmCRKglKSFL2ltH4vNkUTigmZnIO_8FZH6OJnPg,17521
|
36
36
|
squad/ci/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
squad/ci/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
38
|
squad/ci/management/commands/create_tuxsuite_boot_tests.py,sha256=JvjNusebLX71eyz9d-kaeCyekYSpzc1eXoeIqWK9ygo,4045
|
@@ -431,9 +431,9 @@ squad/run/__main__.py,sha256=DOl8JOi4Yg7DdtwnUeGqtYBJ6P2k-D2psAEuYOjWr8w,66
|
|
431
431
|
squad/run/listener.py,sha256=jBeOQhPGb4EdIREB1QsCzYuumsfJ-TqJPd3nR-0m59g,200
|
432
432
|
squad/run/scheduler.py,sha256=CDJG3q5C0GuQuxwlMOfWTSSJpDdwbR6rzpbJfuA0xuw,277
|
433
433
|
squad/run/worker.py,sha256=jtML0h5qKDuSbpJ6_rpWP4MT_rsGA7a24AhwGxBquzk,594
|
434
|
-
squad-1.
|
435
|
-
squad-1.
|
436
|
-
squad-1.
|
437
|
-
squad-1.
|
438
|
-
squad-1.
|
439
|
-
squad-1.
|
434
|
+
squad-1.86.3.dist-info/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
435
|
+
squad-1.86.3.dist-info/METADATA,sha256=EnJrMFG-4ivsJncbuLs1S-_wOSjgR45ViaH0i6Og76E,1236
|
436
|
+
squad-1.86.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
437
|
+
squad-1.86.3.dist-info/entry_points.txt,sha256=apCDQydHZtvqV334ql6NhTJUAJeZRdtAm0TVcbbAi5Q,194
|
438
|
+
squad-1.86.3.dist-info/top_level.txt,sha256=_x9uqE1XppiiytmVTl_qNgpnXus6Gsef69HqfliE7WI,6
|
439
|
+
squad-1.86.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|