django-restit 4.2.43__py3-none-any.whl → 4.2.45__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.
- account/rpc/group.py +1 -1
- {django_restit-4.2.43.dist-info → django_restit-4.2.45.dist-info}/METADATA +1 -1
- {django_restit-4.2.43.dist-info → django_restit-4.2.45.dist-info}/RECORD +11 -10
- location/migrations/0003_address_postalcode_suffix.py +18 -0
- location/models/address.py +20 -6
- location/providers/iplookup/restit.py +1 -1
- rest/__init__.py +1 -1
- taskqueue/models.py +21 -1
- taskqueue/worker.py +6 -5
- {django_restit-4.2.43.dist-info → django_restit-4.2.45.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.43.dist-info → django_restit-4.2.45.dist-info}/WHEEL +0 -0
account/rpc/group.py
CHANGED
@@ -83,7 +83,7 @@ def rest_on_membership(request, pk=None):
|
|
83
83
|
@rd.login_required
|
84
84
|
def rest_on_users_membership(request, group_id=None):
|
85
85
|
ms = request.member.getMembershipFor(group_id, include_parents=True)
|
86
|
-
if ms is None:
|
86
|
+
if ms is None or not ms.is_enabled:
|
87
87
|
return rv.restStatus(request, False, error="not found", error_code=404)
|
88
88
|
return ms.restGet(request)
|
89
89
|
|
@@ -38,7 +38,7 @@ account/periodic.py,sha256=-u0n-7QTJgDOkasGhBAPwHAwjpqWGA-MZLEFkVTqCGU,874
|
|
38
38
|
account/rpc/__init__.py,sha256=SGF0M_-H0dKh3b1apSX29BotNWAvITYccGQVC0MIjL8,336
|
39
39
|
account/rpc/auth.py,sha256=eywdJSjsi_Ds2pM4wnltPJUfjIQqf6r6e99eKS7q3BA,15593
|
40
40
|
account/rpc/device.py,sha256=fbbZFp3cUdhVXvD7gVFOqFWj4hKS3bjZKD_aF5fQxd8,2852
|
41
|
-
account/rpc/group.py,sha256=
|
41
|
+
account/rpc/group.py,sha256=eW5p0TbJC7b77Xf7CTqLm-Qq_r1FPbGmSuVWrQR37uA,3823
|
42
42
|
account/rpc/member.py,sha256=PU-Uz5KUI_BZFy-F-taDqAfnt_AwONYXSzUvfm7eyTw,1264
|
43
43
|
account/rpc/notify.py,sha256=Q2YWejP36egeF060Hih5uX4Psv_B8NWlLLPi7iDYlIw,3344
|
44
44
|
account/rpc/oauth.py,sha256=ISLVsR5HvKALANokaOFRvF4FTRxWtXPvVnZAYANKxpo,2864
|
@@ -120,9 +120,10 @@ location/admin.py,sha256=6S97Rlgjkk0jM15sbT1OJRPZbgvKn2rn7duCSazOXq4,297
|
|
120
120
|
location/geolocate.py,sha256=UgV129vmSxnqYFBYJD2RQVOcC1-lJJ1zUaxDqOJRbG4,1694
|
121
121
|
location/migrations/0001_initial.py,sha256=E0Kekah0vfp7VGKGYRHFEIFjFRTkd8QnFGSHNFllVv0,7000
|
122
122
|
location/migrations/0002_geoip_subnet_alter_geoip_ip.py,sha256=n-oJrEnIqN9VnMhiZsr34LF-EXBluPm1lz1zusaMkx8,576
|
123
|
+
location/migrations/0003_address_postalcode_suffix.py,sha256=DT8voJeMiSQyUhH-69NHK9YywaChAvIJn1ztL7fCI30,443
|
123
124
|
location/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
124
125
|
location/models/__init__.py,sha256=rZhldkoKmoJQXjBAK1IIQn7K_OOJvFtIGOGVl_szqbE,230
|
125
|
-
location/models/address.py,sha256=
|
126
|
+
location/models/address.py,sha256=oTPQiLdg2QkfPorlm16re1OoR6TJf4Of2Ew1slun2r8,2596
|
126
127
|
location/models/ip.py,sha256=ZaBFdW1tL1Q3bnS5gIY9SseiQ5xeeP_oyP1hp3czFeA,5984
|
127
128
|
location/models/legacy.py,sha256=8ROsUSZrjGQkUyXeJvoxPdKAWaKfUH-AL9TIeJb7krg,1994
|
128
129
|
location/models/location.py,sha256=01dJPJecbp5orExsIGWOsBC_KkwFRIW0rGDIwyx1r0w,2316
|
@@ -134,7 +135,7 @@ location/providers/iplookup/extremeip.py,sha256=QNRGhwXXsOuJL2M-xiI2pFN_6LP2HkqS
|
|
134
135
|
location/providers/iplookup/geoplugin.py,sha256=RK_6McxHYlVVMVdJ2rCafw-kqMfzMm3g_tJjBwcKXYg,2121
|
135
136
|
location/providers/iplookup/ipapi.py,sha256=cyVs_n4GYvmLsPn8jDOcfevPzWkwBs22PSzoYRzVhDo,1797
|
136
137
|
location/providers/iplookup/ipinfo.py,sha256=G3mrBQOAOzWkQBXf8uF98-xVPSA4HGAkYl4PlwmeKVU,1265
|
137
|
-
location/providers/iplookup/restit.py,sha256=
|
138
|
+
location/providers/iplookup/restit.py,sha256=UJlQ_-X85YhyO4Yqt7ys8-MFY_zQcAKHecaIOxL844U,937
|
138
139
|
location/providers/location/__init__.py,sha256=ki4sfPrgHMMr50GCKGZb2NDK0Unl8xkgcWJT7fsWgwA,42
|
139
140
|
location/providers/location/google.py,sha256=RXZoYXUcTerE3-7z2BciEuDJJB-f-0_F6jWLnEK5v8w,2860
|
140
141
|
location/providers/timezones/__init__.py,sha256=enslc1cVTju3GKrvpLoAxSHUKkLeREhed-eHkvHWdoM,46
|
@@ -359,7 +360,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
359
360
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
360
361
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
361
362
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
362
|
-
rest/__init__.py,sha256=
|
363
|
+
rest/__init__.py,sha256=1X-W3BH6L-ujXvvzyMW1tIIeqHcQOhgRzb6isSAl9mY,121
|
363
364
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
364
365
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
365
366
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -440,7 +441,7 @@ taskqueue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
440
441
|
taskqueue/admin.py,sha256=E6zXoToS_ea3MdoGjZzF1JiepWFtDSoZUQdan8H-pXI,208
|
441
442
|
taskqueue/migrations/0001_initial.py,sha256=JwYib8CK5ftSXlfxKZUcKEEVsXktNB5q3h-2tu9inGk,4738
|
442
443
|
taskqueue/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
443
|
-
taskqueue/models.py,sha256=
|
444
|
+
taskqueue/models.py,sha256=tCFAKSr8JybUJV4gijg3wUCwQMJiHUsRBgHH2CWonfY,22119
|
444
445
|
taskqueue/periodic.py,sha256=2i0271khrCow3hDmlNEcoAZnesBVl40jd7MIim2Cxs4,3543
|
445
446
|
taskqueue/rpc.py,sha256=If5E9D9AR2RqW4lHRaDuD9L9b9ZfL_PaBQ6iX91ehvU,5736
|
446
447
|
taskqueue/tq.py,sha256=PzSoDrawYcqZylruEgsK95gcJ4J_VhdM6rxg9V6_X8E,942
|
@@ -450,7 +451,7 @@ taskqueue/transports/http.py,sha256=kRBjHiwTmk5b4TMdZWt1EKKcjfSlX8DFmtmJaRGZQFw,
|
|
450
451
|
taskqueue/transports/s3.py,sha256=fMosL893u1iQdo6Y1djwb7KEoNo6TTsDPJl13OJdJP8,1913
|
451
452
|
taskqueue/transports/sftp.py,sha256=jT1_krjTHA7DCAukD85aGYRCg9m0cEH9EWzOC-wJGdk,1891
|
452
453
|
taskqueue/transports/sms.py,sha256=H1-LIGEMfbUNqJD9amRcsvKUSwtz9yBj1QNfB7EHjHE,142
|
453
|
-
taskqueue/worker.py,sha256=
|
454
|
+
taskqueue/worker.py,sha256=u7H-FLkz7vpBoDaab9hpw4RduvG1ZTdtlw3PSHRBmUw,15737
|
454
455
|
telephony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
455
456
|
telephony/admin.py,sha256=iOdsBfFFbBisdqKSZ36bIrh_z5sU0Wx_PkaFi8wd1iA,243
|
456
457
|
telephony/decorators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -492,7 +493,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
492
493
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
493
494
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
494
495
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
495
|
-
django_restit-4.2.
|
496
|
-
django_restit-4.2.
|
497
|
-
django_restit-4.2.
|
498
|
-
django_restit-4.2.
|
496
|
+
django_restit-4.2.45.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
497
|
+
django_restit-4.2.45.dist-info/METADATA,sha256=sjprDnHaz3wHRJMOMfpI0y3UMinbPipZ0aB8mboJGdI,7594
|
498
|
+
django_restit-4.2.45.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
499
|
+
django_restit-4.2.45.dist-info/RECORD,,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by Django 4.1.4 on 2024-02-20 21:15
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
('location', '0002_geoip_subnet_alter_geoip_ip'),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AddField(
|
14
|
+
model_name='address',
|
15
|
+
name='postalcode_suffix',
|
16
|
+
field=models.CharField(blank=True, default=None, max_length=32, null=True),
|
17
|
+
),
|
18
|
+
]
|
location/models/address.py
CHANGED
@@ -27,6 +27,7 @@ class Address(models.Model, rm.RestModel):
|
|
27
27
|
county = models.CharField(max_length=127, blank=True, null=True, default=None)
|
28
28
|
country = models.CharField(max_length=16, blank=True, null=True, default=None)
|
29
29
|
postalcode = models.CharField(max_length=32, blank=True, null=True, default=None)
|
30
|
+
postalcode_suffix = models.CharField(max_length=32, blank=True, null=True, default=None)
|
30
31
|
lat = models.FloatField(default=0.0, blank=True)
|
31
32
|
lng = models.FloatField(default=0.0, blank=True)
|
32
33
|
|
@@ -35,14 +36,27 @@ class Address(models.Model, rm.RestModel):
|
|
35
36
|
return geolocate.getTimeZone(self.lat, self.lng)
|
36
37
|
return None
|
37
38
|
|
39
|
+
def lookup(self):
|
40
|
+
res = geolocate.search("{}, {}, {}".format(self.line1, self.city, self.state))
|
41
|
+
if isinstance(res, list) and len(res):
|
42
|
+
return res[0]
|
43
|
+
return None
|
44
|
+
|
38
45
|
def refresh(self):
|
39
46
|
try:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
addr = self.lookup()
|
48
|
+
if addr:
|
49
|
+
if addr.county:
|
50
|
+
self.county = addr.county
|
51
|
+
self.country = addr.country
|
52
|
+
if addr.lat:
|
53
|
+
self.lat = addr.lat
|
54
|
+
self.lng = addr.lng
|
55
|
+
if not self.postalcode and addr.postal_code:
|
56
|
+
self.postalcode = addr.postal_code
|
57
|
+
if addr.postal_code_suffix:
|
58
|
+
self.postalcode_suffix = addr.postal_code_suffix
|
59
|
+
super(Address, self).save()
|
46
60
|
except Exception:
|
47
61
|
rh.log_exception("address.refresh")
|
48
62
|
|
@@ -26,7 +26,7 @@ def getLocation(ip):
|
|
26
26
|
if GEOIP_RESTIT_HOST is None:
|
27
27
|
return None
|
28
28
|
params = {"ip": ip}
|
29
|
-
url = f"https://{GEOIP_RESTIT_HOST}/
|
29
|
+
url = f"https://{GEOIP_RESTIT_HOST}/api/location/ip/lookup"
|
30
30
|
res = requests.get(url, params=params)
|
31
31
|
if res.status_code != 200:
|
32
32
|
return None
|
rest/__init__.py
CHANGED
taskqueue/models.py
CHANGED
@@ -31,6 +31,10 @@ TASK_STATES = [
|
|
31
31
|
(TASK_STATE_CANCELED, 'canceled')
|
32
32
|
]
|
33
33
|
|
34
|
+
TQ_RETRY_BACKOFF_FACTOR = settings.get("TQ_RETRY_BACKOFF_FACTOR", 2)
|
35
|
+
TQ_RETRY_ATTEMPTS = settings.get("TQ_RETRY_ATTEMPTS", 5)
|
36
|
+
TQ_RETRY_DELAY = settings.get("TQ_RETRY_DELAY", 60)
|
37
|
+
|
34
38
|
def getAppHandler(app_name, fname):
|
35
39
|
try:
|
36
40
|
# module = __import__(app_name + '.tq', globals(), locals(), ['*'], 0)
|
@@ -143,6 +147,12 @@ class Task(models.Model, RestModel):
|
|
143
147
|
return self.runtime
|
144
148
|
return (datetime.now() - self.started_at).total_seconds()
|
145
149
|
|
150
|
+
@property
|
151
|
+
def max_attempts(self):
|
152
|
+
if self.data:
|
153
|
+
return self.data.get("retry_max_attempts", TQ_RETRY_ATTEMPTS)
|
154
|
+
return TQ_RETRY_ATTEMPTS
|
155
|
+
|
146
156
|
def set_action(self, value):
|
147
157
|
if value == "retry_now":
|
148
158
|
self.retry_now()
|
@@ -187,7 +197,17 @@ class Task(models.Model, RestModel):
|
|
187
197
|
def retry_later(self, reason=None, from_now_secs=None):
|
188
198
|
if reason:
|
189
199
|
self.reason = reason
|
190
|
-
if from_now_secs:
|
200
|
+
if from_now_secs == -1:
|
201
|
+
# allow backoff retry
|
202
|
+
if self.data:
|
203
|
+
bof = self.data.get("retry_bof", TQ_RETRY_BACKOFF_FACTOR)
|
204
|
+
delay = self.data.get("retry_delay", TQ_RETRY_DELAY)
|
205
|
+
else:
|
206
|
+
bof = TQ_RETRY_BACKOFF_FACTOR
|
207
|
+
delay = TQ_RETRY_DELAY
|
208
|
+
attempts = self.attempts - 1
|
209
|
+
from_now_secs = delay * (bof ** attempts)
|
210
|
+
if from_now_secs is not None:
|
191
211
|
# this will not run the task again until after this time has been hit
|
192
212
|
self.scheduled_for = datetime.now() + timedelta(seconds=from_now_secs)
|
193
213
|
self.state = TASK_STATE_RETRY
|
taskqueue/worker.py
CHANGED
@@ -178,7 +178,7 @@ class WorkManager(object):
|
|
178
178
|
pass
|
179
179
|
|
180
180
|
def processBacklog(self):
|
181
|
-
tasks = Task.objects.filter(state__in=[0,1,2])
|
181
|
+
tasks = Task.objects.filter(state__in=[0, 1, 2])
|
182
182
|
for task in tasks:
|
183
183
|
if task.channel in self.subscribe_to:
|
184
184
|
if task.cancel_requested:
|
@@ -196,8 +196,9 @@ class WorkManager(object):
|
|
196
196
|
def _on_webrequest(self, task):
|
197
197
|
if http.REQUEST(task):
|
198
198
|
task.completed()
|
199
|
-
elif task.attempts <
|
200
|
-
|
199
|
+
elif task.attempts < task.max_attempts:
|
200
|
+
# -1 will auto calculate retry with back off
|
201
|
+
task.retry_later(from_now_secs=-1)
|
201
202
|
else:
|
202
203
|
task.failed("max attempts")
|
203
204
|
|
@@ -212,8 +213,8 @@ class WorkManager(object):
|
|
212
213
|
resp = s3.UPLOAD(task)
|
213
214
|
if resp:
|
214
215
|
task.completed()
|
215
|
-
elif task.
|
216
|
-
task.retry_later(from_now_secs
|
216
|
+
elif task.attempts < task.max_attempts:
|
217
|
+
task.retry_later(from_now_secs=-1)
|
217
218
|
else:
|
218
219
|
task.failed()
|
219
220
|
|
File without changes
|
File without changes
|