django-restit 4.2.29__py3-none-any.whl → 4.2.31__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.29
3
+ Version: 4.2.31
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -114,7 +114,7 @@ incident/rpc.py,sha256=-voKgyKlyL5sosXtalWT1yytCtjzcjX7yX81yboaB8k,7680
114
114
  incident/templates/email/incident_change.html,sha256=O_5ocWTsnqmmOuQhAtXEiE4rWecnZnJjoKU4MwV6ILo,14178
115
115
  incident/templates/email/incident_new.html,sha256=IPX3CqIrvdrZSn13_jlR6sEb0If8ftvUrUpkzC5G2Gc,15173
116
116
  incident/templates/email/incident_plain.html,sha256=fx4zsoldG1AQEBA6IYx5BJp_MAMizgjjx9EmuR5m4SQ,14727
117
- incident/tq.py,sha256=sAArYa_xid_HD2dgS1grer5l_jmoAgV0eA17yJaFmns,5079
117
+ incident/tq.py,sha256=6GGGVKzcbslDBz0oDyBSKdFCLYWKYiVkUeOEiHOOfcM,5049
118
118
  location/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  location/admin.py,sha256=6S97Rlgjkk0jM15sbT1OJRPZbgvKn2rn7duCSazOXq4,297
120
120
  location/geolocate.py,sha256=UgV129vmSxnqYFBYJD2RQVOcC1-lJJ1zUaxDqOJRbG4,1694
@@ -359,7 +359,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
359
359
  rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
360
360
  rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
361
361
  rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
362
- rest/__init__.py,sha256=SxPZeJ8SfzXhG57OGTTQp7d2Te0l-riKdSuXvcLSNc0,121
362
+ rest/__init__.py,sha256=iqS1TYxzy3PsvhaN98G9-46-zcIVaX0fdZCRWBLjhI0,121
363
363
  rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
364
364
  rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
365
365
  rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
@@ -480,10 +480,10 @@ wiki/rpc/wiki.py,sha256=iWehZasU8J1E5sPPqz9QoQr3MpGxqu3rd7CH4wFrm2w,1333
480
480
  wiki/tq.py,sha256=wvuBZ3OMV_D2o4kpJhVLIOwpEUfwlglqLJQvpncAwtk,313
481
481
  ws4redis/README.md,sha256=QvwdsauPKxx4qQqnJ991xeU8DgFQCj3CeQt-nCE4s-w,3624
482
482
  ws4redis/__init__.py,sha256=teNfv83A_ke1CBt9BB7NsnWCcFBhnUFPsPESjF554_k,46
483
- ws4redis/client.py,sha256=-WIfAW34zxEkJtoDgFSUK1Uu_wv1Gt9Vs2IFG_S3U1o,5208
483
+ ws4redis/client.py,sha256=0PXDFHb7P7BRjvT0_3Al9ZOfsljMzng93HsSl90nzro,5225
484
484
  ws4redis/connection.py,sha256=QGjzalYrx1y4o6sb6P1akL-Y2fjf2qil0JCo-ona5F8,13431
485
485
  ws4redis/exceptions.py,sha256=EGLoRTdqJVwz900pwhciqPuSjBBd08hhLgFu6umHrI4,636
486
- ws4redis/redis.py,sha256=AmkiKc-KIytjAqNYIj6BBveJZfvmM7HA-anMGe_nlrU,5561
486
+ ws4redis/redis.py,sha256=IfT4p3bUtlqso9rryNliH9Ebzlx8-Q2VJcs1kFioeGA,6093
487
487
  ws4redis/servers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
488
488
  ws4redis/servers/base.py,sha256=3nYZF5jSsQxNLbnLtKLFJ82xJs_Mc7N1H2kEOx8wT6o,3747
489
489
  ws4redis/servers/django.py,sha256=iNzWtGN4vZ-2ltClayCnPD-OPvB_ZGySnKD2EyXl6l8,4329
@@ -491,7 +491,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
491
491
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
492
492
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
493
493
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
494
- django_restit-4.2.29.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
495
- django_restit-4.2.29.dist-info/METADATA,sha256=XcvsK0sdSM_cvCbc4lmO_KhN2RHXSj7dCpJZlzWZUtA,7594
496
- django_restit-4.2.29.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
497
- django_restit-4.2.29.dist-info/RECORD,,
494
+ django_restit-4.2.31.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
495
+ django_restit-4.2.31.dist-info/METADATA,sha256=UYUdYMTNLK1RQ-hXzGcxaN9IFPS3miDGix62wl8YeYU,7594
496
+ django_restit-4.2.31.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
497
+ django_restit-4.2.31.dist-info/RECORD,,
incident/tq.py CHANGED
@@ -136,9 +136,8 @@ def run_auto_close(task):
136
136
  # lets check any incidents that haven't reached action threshold and older then bundle time
137
137
  qset = ia.Incident.objects.filter(state=ia.INCIDENT_STATE_PENDING)
138
138
  for inc in qset:
139
- if inc.bundle_expired and not inc.action_triggered:
139
+ if inc.bundle_expired:
140
140
  inc.state = ia.INCIDENT_STATE_IGNORE
141
141
  inc.save()
142
142
  inc.logHistory("history", "auto ignore", notify=False)
143
143
 
144
-
rest/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .uberdict import UberDict # noqa: F401
2
2
  from .settings_helper import settings # noqa: F401
3
3
 
4
- __version__ = "4.2.29"
4
+ __version__ = "4.2.31"
ws4redis/client.py CHANGED
@@ -188,8 +188,8 @@ def subscribe(channel):
188
188
  return pubsub
189
189
 
190
190
 
191
- def waitForMessage(pubsub, msg_filter):
192
- timeout_at = time.time() + 55
191
+ def waitForMessage(pubsub, msg_filter, timeout=55):
192
+ timeout_at = time.time() + timeout
193
193
  while time.time() < timeout_at:
194
194
  message = pubsub.get_message()
195
195
  if message is not None:
ws4redis/redis.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from redis import ConnectionPool, StrictRedis
2
2
 
3
3
  from ws4redis import settings
4
+ import time
4
5
 
5
6
  from rest import UberDict
6
7
  from rest.log import getLogger
@@ -25,7 +26,7 @@ class RedisMessage(bytes):
25
26
  if len(value) >= 2 and value[0] == b'message':
26
27
  return value[2]
27
28
  elif isinstance(value, dict):
28
- if not isinstance(value, UberDict):
29
+ if not hasattr(value, "toJSON"):
29
30
  value = UberDict(value)
30
31
  return bytes(value.toJSON(as_string=True), 'utf-8')
31
32
  elif isinstance(value, bytes):
@@ -84,7 +85,7 @@ class RedisStore():
84
85
  key = F'{prefix}:{channel}:{pk}:{facility}'
85
86
  return key
86
87
 
87
- def subscribe(self, channel, facility, pk=None, prefix=settings.WS4REDIS_PREFIX):
88
+ def subscribe(self, channel, facility="events", pk=None, prefix=settings.WS4REDIS_PREFIX):
88
89
  if self.pubsub is None:
89
90
  self.pubsub = self.connection.pubsub()
90
91
  key = self.channelToKey(channel, facility, pk, prefix)
@@ -128,6 +129,15 @@ class RedisStore():
128
129
  if count == 0:
129
130
  self.connection.srem(F"{name}:online", pk)
130
131
 
132
+ def waitForMessage(self, muid=None, timeout=55):
133
+ timeout_at = time.time() + timeout
134
+ while time.time() < timeout_at:
135
+ message = self.pubsub.get_message()
136
+ if message is not None and message.get("type") == "message":
137
+ return UberDict.fromJSON(message.get("data"))
138
+ time.sleep(1.0)
139
+ return None
140
+
131
141
  def get_file_descriptor(self):
132
142
  """
133
143
  Returns the file descriptor used for passing to the select call when listening
@@ -147,3 +157,9 @@ class RedisStore():
147
157
  self.pubsub.unsubscribe()
148
158
  self.pubsub.reset()
149
159
 
160
+ def __enter__(self):
161
+ return self
162
+
163
+ def __exit__(self, exc_type, exc_value, traceback):
164
+ self.release()
165
+ return False