django-restit 4.2.151__py3-none-any.whl → 4.2.153__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.151
3
+ Version: 4.2.153
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -91,7 +91,7 @@ inbox/models/message.py,sha256=acPm2z0QsucoFFmfzPekehElZm8EMzkcGChX_BpzGLU,3758
91
91
  inbox/models/template.py,sha256=i5vf0vsM1U0251UmVsF61MDCV_c7xt-zdCdx1SiKOG0,1013
92
92
  inbox/rpc.py,sha256=7JXvpXlEGKG7by_NkANPGYLCzagyCnTIGM4rme_htpk,1534
93
93
  inbox/utils/__init__.py,sha256=P_UR2rGK3L0tZNlTN-mf99tpeYM-tLkA18iDKXSSLDM,89
94
- inbox/utils/parsing.py,sha256=ORYgg_QRKQqv3M3vok1MPK7eIMmmwqUwxk_Fa-cb3bM,5550
94
+ inbox/utils/parsing.py,sha256=y_71dwz8bm3JvF35ol8698XJ36sBF8fQWUrn0sYd2Fs,5597
95
95
  inbox/utils/render.py,sha256=CU_F2qUBQE7mjb9Q6Dn9ro5CS_O_zEY-wDMHEClKkIA,4331
96
96
  inbox/utils/sending.py,sha256=BKelTZnbkdSLGpjOY6IRTrzj-Hnw2pPZ7RYQGwe-tqk,2179
97
97
  incident/README.md,sha256=4vbZTJj7uUmq8rogYngxqNYjFTlBOujfWUGheLoFKMc,1114
@@ -242,7 +242,7 @@ medialib/static/lib/tinymce/plugins/medialib/editor_plugin.js,sha256=We_6msWhBiy
242
242
  medialib/static/lib/tinymce/plugins/medialib/editor_plugin_src.js,sha256=We_6msWhBiyj0MCwU2mA-Obz_JzKSN743wEgelBLtek,1163
243
243
  medialib/static/lib/tinymce/plugins/medialib/js/dialog.js,sha256=PSGxVxHpY9m5D_ZijapOx_-Xl4a_E3l5Z0py6kDXvfE,5708
244
244
  medialib/static/lib/tinymce/plugins/medialib/medialib.html,sha256=7zoWtyXkUgt645D5Xol7KIb7Z2oErapBaVmClJL-958,3502
245
- medialib/stores/__init__.py,sha256=HvPbBTov-lekG0szyXylrKzEVNL5egIuqW4U42IMLZw,5876
245
+ medialib/stores/__init__.py,sha256=sVo0IHoxgMj19qllzT2zsrt0R22NvWLJKN0kzwahvpI,5875
246
246
  medialib/stores/apiclient/__init__.py,sha256=iGdQFKwzm0VxArl8X183-_ZBhIsETZlbXxhBAUz3MfI,601
247
247
  medialib/stores/apiclient/channel.py,sha256=gsv_9XG0sDO4_rIiIJ06FA_30ZivMaqMwfibqGKFLWQ,9852
248
248
  medialib/stores/apiclient/discovery.py,sha256=IQdIU7utMR9Zt0C9MkEjFE_Pla6zoFy9dkRAiI8VdJI,35929
@@ -356,14 +356,14 @@ metrics/migrations/0003_metrics_expires.py,sha256=_g4oRv4NHW-4iCQx2s1SiF38LLyFf8
356
356
  metrics/migrations/0004_eodmetrics.py,sha256=Ky6ZVMZqa0F_SUp_QFWY7ZKBgVhy9CS4wZcsEhrkSgc,3271
357
357
  metrics/migrations/0005_alter_metrics_v1_alter_metrics_v10_alter_metrics_v11_and_more.py,sha256=pmwJfpPJ1RUX_CqM66l6vvV-nrAUPo_GIan0Pc9mQHs,2358
358
358
  metrics/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
- metrics/models.py,sha256=SF3fCAK43GIDh1_wkkoSc5cv1zKBDo4gv0mP5lFxPwc,13564
359
+ metrics/models.py,sha256=ytr4b4S7xlmNjW5C644OgFV_ITu-XTl-B-KgdmjsYdQ,13871
360
360
  metrics/periodic.py,sha256=IayBLLat40D8FB-A3bYBW9lxm9-IzcugQunojThQ_OU,661
361
361
  metrics/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
362
  metrics/providers/aws.py,sha256=dIBGFE1Fvszy6rmVrn_Fm1zUDv345q4dBsg9Iit-XCc,8358
363
363
  metrics/rpc.py,sha256=gnyRFBW2KBA-TAiqVcwkoVviX4bPbZ2WZELlR9uEUlM,22213
364
364
  metrics/settings.py,sha256=wwHA9Z7BAHNeu3tFVn8Fh5j46KR-eGx0E8r5dzCFlAU,132
365
365
  metrics/tq.py,sha256=WHBRYSinmTuxF9l-_-lx0yfzEYkb0ffVMt_uvCj9bYo,825
366
- metrics/utils.py,sha256=PSydxeI983udULUTcbeWG-_ulPSOac6Q_t_8k_Vjn1I,12606
366
+ metrics/utils.py,sha256=QZ9Gcv_vsh3yS5laXGMJQgGxmanwC1LfVhfAkAZl2yk,12607
367
367
  pushit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
368
368
  pushit/admin.py,sha256=69HdDZU_Iz8Fm72M8r8FUztsZvW37zdGwVmj8VTqr0c,451
369
369
  pushit/migrations/0001_initial.py,sha256=kYF1ksOlKf9ElrlagGhpNf5GbKEq6SORWGreMH9A7as,4555
@@ -379,7 +379,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
379
379
  rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
380
380
  rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
381
381
  rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
382
- rest/__init__.py,sha256=NlPBDSPooXfNg535Lz8YBFDbF0KQOjtEHtUd8dGdGOA,122
382
+ rest/__init__.py,sha256=8aFIz-8RHV4xBWuoJXgDNggbkdl1BC7eSkON9J2HXVY,122
383
383
  rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
384
384
  rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
385
385
  rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
@@ -515,7 +515,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
515
515
  ws4redis/settings.py,sha256=KKq00EwoGnz1yLwCZr5Dfoq2izivmAdsNEEM4EhZwN4,1610
516
516
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
517
517
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
518
- django_restit-4.2.151.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
519
- django_restit-4.2.151.dist-info/METADATA,sha256=0mVYsiUDKwkB_0VkL_-c_AYqtKqycTiUyl7-UWGsV4Y,7663
520
- django_restit-4.2.151.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
521
- django_restit-4.2.151.dist-info/RECORD,,
518
+ django_restit-4.2.153.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
519
+ django_restit-4.2.153.dist-info/METADATA,sha256=VojJKBZUJNrnd64vmXxVW51-UNOstFLOcaMDflyUgbg,7663
520
+ django_restit-4.2.153.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
521
+ django_restit-4.2.153.dist-info/RECORD,,
inbox/utils/parsing.py CHANGED
@@ -132,6 +132,8 @@ def toFileObject(attachment):
132
132
 
133
133
 
134
134
  def parseAddresses(input_string, force_name=False):
135
+ if input_string is None:
136
+ return []
135
137
  # Define a regex pattern to capture email addresses
136
138
  email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
137
139
  # Find all matches of the pattern in the input string
@@ -53,7 +53,7 @@ def view_url(url, expires=600, is_secure=False, request=None):
53
53
  mpath = url[len(k):]
54
54
  try:
55
55
  ext = mpath.rsplit('.', 1)[1]
56
- except ValueError:
56
+ except Exception:
57
57
  ext = None
58
58
  srcip = getattr(request, 'META', {}).get('REMOTE_ADDR', None)
59
59
  try:
metrics/models.py CHANGED
@@ -192,10 +192,8 @@ def get_metrics(slug, granularity, start, end=None, group=None, samples=None):
192
192
  start = utils.start_by_granularity(granularity, start, samples=samples)
193
193
  # set the correct end for this granularity
194
194
  end = utils.date_for_granulatiry(end, granularity)
195
-
196
195
  qset = Metrics.objects.filter(
197
196
  slug=slug, granularity=granularity, start__gte=start, start__lte=end, group=group)
198
- raw_metrics = dict()
199
197
  # now we want to get the keys from the most recent object (latest keys if changed)
200
198
  keys = None
201
199
  obj = qset.last()
@@ -203,27 +201,29 @@ def get_metrics(slug, granularity, start, end=None, group=None, samples=None):
203
201
  return objict(periods=[], data={})
204
202
  values = obj.getMetrics()
205
203
  keys = values.keys()
206
-
207
- for obj in qset:
204
+ period_values = []
205
+ for obj in qset.order_by("uuid"):
208
206
  values = obj.getMetrics()
209
- raw_metrics[utils.slug_to_label(obj.uuid)] = values
210
-
207
+ pvals = objict(uuid=obj.uuid, period=utils.slug_to_label(obj.uuid), values=values)
208
+ period_values.append(pvals)
211
209
  periods = get_chart_periods(slug, granularity, start, end)
212
-
210
+ # now we assume that our raw metrics are sorted correctly
213
211
  data = dict()
214
212
  if keys is None:
215
213
  return objict(periods=periods, data=data)
216
214
  for k in keys:
217
215
  data[k] = []
218
-
216
+ # this logic is not perfect
217
+ # it will find the first match first the last match
219
218
  for period in periods:
220
- if period not in raw_metrics:
219
+ result = next((d for d in period_values if d.get("period") == period), None)
220
+ if result is None:
221
221
  for k in keys:
222
222
  data[k].append(0)
223
- else:
224
- values = raw_metrics[period]
225
- for k in keys:
226
- data[k].append(values.get(k, 0))
223
+ continue
224
+ for k in keys:
225
+ data[k].append(result["values"].get(k, 0))
226
+ period_values.remove(result)
227
227
  return objict(periods=periods, data=data)
228
228
 
229
229
 
metrics/utils.py CHANGED
@@ -202,6 +202,7 @@ def slug_to_label(slug):
202
202
  return f"{lbl[-5:]}".replace("-", ":")
203
203
  return lbl
204
204
 
205
+
205
206
  def date_for_granulatiry(date, granularity):
206
207
  if granularity == "minutes":
207
208
  return date.replace(second=0, microsecond=0)
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.151"
4
+ __version__ = "4.2.153"