django-restit 4.2.134__py3-none-any.whl → 4.2.136__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/models/group.py +36 -17
- account/models/member.py +6 -2
- account/models/notify.py +9 -0
- {django_restit-4.2.134.dist-info → django_restit-4.2.136.dist-info}/METADATA +1 -1
- {django_restit-4.2.134.dist-info → django_restit-4.2.136.dist-info}/RECORD +10 -10
- medialib/stores/s3.py +5 -1
- rest/__init__.py +1 -1
- rest/helpers.py +4 -0
- {django_restit-4.2.134.dist-info → django_restit-4.2.136.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.134.dist-info → django_restit-4.2.136.dist-info}/WHEEL +0 -0
account/models/group.py
CHANGED
@@ -132,14 +132,27 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
132
132
|
]
|
133
133
|
}
|
134
134
|
|
135
|
+
_tz_long = None
|
136
|
+
_tz_short = None
|
137
|
+
_eod_hour = None
|
138
|
+
|
135
139
|
@property
|
136
140
|
def timezone(self):
|
137
|
-
|
141
|
+
if self._tz_long is None:
|
142
|
+
self._tz_long = self.getParentProperty("timezone", "America/Los_Angeles")
|
143
|
+
return self._tz_long
|
138
144
|
|
139
145
|
@property
|
140
146
|
def timezone_short(self):
|
141
|
-
|
142
|
-
|
147
|
+
if self._tz_short is None:
|
148
|
+
self._tz_short = rh.getShortTZ(self.timezone)
|
149
|
+
return self._tz_short
|
150
|
+
|
151
|
+
@property
|
152
|
+
def end_of_day_hour(self):
|
153
|
+
if self._eod_hour is None:
|
154
|
+
self._eod_hour = self.getParentProperty("eod", 0, field_type=int)
|
155
|
+
return self._eod_hour
|
143
156
|
|
144
157
|
@property
|
145
158
|
def file_safe_name(self):
|
@@ -234,6 +247,8 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
234
247
|
|
235
248
|
def set_timezone(self, value):
|
236
249
|
if self.pk:
|
250
|
+
self._tz_long = None
|
251
|
+
self._tz_short = None
|
237
252
|
self.setProperty("timezone", value)
|
238
253
|
|
239
254
|
def getChildModels(self, Model, grand_children=False, great_grand_children=False):
|
@@ -341,35 +356,39 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
341
356
|
return True
|
342
357
|
return False
|
343
358
|
|
359
|
+
def getParentProperty(self, key, default=None, category=None, field_type=None, decrypted=False):
|
360
|
+
val = self.getProperty(key, rh.UNKNOWN, category, field_type, decrypted)
|
361
|
+
if val != rh.UNKNOWN:
|
362
|
+
return val
|
363
|
+
if self.parent:
|
364
|
+
val = self.parent.getProperty(key, rh.UNKNOWN, category, field_type, decrypted)
|
365
|
+
if val != rh.UNKNOWN:
|
366
|
+
return val
|
367
|
+
return self.parent.getParentProperty(key, default, category, field_type, decrypted)
|
368
|
+
return default
|
369
|
+
|
344
370
|
def getLocalTime(self, when=None, tz_aware=False):
|
345
|
-
|
346
|
-
return rh.convertToLocalTime(zone, when, tz_aware)
|
371
|
+
return rh.convertToLocalTime(self.timezone, when, tz_aware)
|
347
372
|
|
348
373
|
def getUTC(self, when):
|
349
|
-
|
350
|
-
return rh.convertToUTC(zone, when)
|
374
|
+
return rh.convertToUTC(self.timezone, when)
|
351
375
|
|
352
376
|
def getBusinessDay(self, start=None, end=None, kind="day"):
|
353
|
-
|
354
|
-
eod = self.getProperty("eod", 0, field_type=int)
|
355
|
-
return rh.getDateRange(start, end, kind, zone, hour=eod)
|
377
|
+
return rh.getDateRange(start, end, kind, self.timezone, hour=self.end_of_day_hour)
|
356
378
|
|
357
379
|
def getOperatingHours(self, start=None, end=None, kind="day"):
|
358
380
|
# deprecate this, operating hours is deceptive
|
359
|
-
|
360
|
-
eod = self.getProperty("eod", 0, field_type=int)
|
361
|
-
return rh.getDateRange(start, end, kind, zone, hour=eod)
|
381
|
+
return rh.getDateRange(start, end, kind, self.timezone, hour=self.end_of_day_hour)
|
362
382
|
|
363
383
|
def getTimeZoneOffset(self, when=None, hour=None):
|
364
|
-
|
365
|
-
return rh.getTimeZoneOffset(zone, when, hour=hour)
|
384
|
+
return rh.getTimeZoneOffset(self.timezone, when, hour=hour)
|
366
385
|
|
367
386
|
def getEOD(self, eod=None, onday=None, in_local=False):
|
368
387
|
if eod is None:
|
369
|
-
eod = self.
|
388
|
+
eod = self.end_of_day_hour
|
370
389
|
if in_local:
|
371
390
|
return eod
|
372
|
-
offset = self.getTimeZoneOffset(onday, hour=
|
391
|
+
offset = self.getTimeZoneOffset(onday, hour=self.end_of_day_hour)
|
373
392
|
return offset
|
374
393
|
|
375
394
|
def updateUUID(self):
|
account/models/member.py
CHANGED
@@ -589,14 +589,18 @@ class Member(User, RestModel, MetaDataModel):
|
|
589
589
|
email_only=True, attachments=attachments)
|
590
590
|
|
591
591
|
def sendInvite(self, subject, group=None, url=None, msg=None, **kwargs):
|
592
|
-
if url is None:
|
593
|
-
url =
|
592
|
+
if url is None and group is not None:
|
593
|
+
url = group.getParentProperty("default_portal")
|
594
|
+
if url is None:
|
595
|
+
url = settings.DEFAULT_LOGIN_URL
|
594
596
|
if url[:4] != "http":
|
595
597
|
url = f"https://{url}"
|
596
598
|
from_domain = rh.parseHostName(url, True)
|
597
599
|
from_email = rh.getFromEmailForHost(from_domain)
|
600
|
+
portal_domain = rh.parseHostName(url, False)
|
598
601
|
self.member.setProperty("default_domain", from_domain)
|
599
602
|
self.member.setProperty("default_from_email", from_email)
|
603
|
+
self.member.setProperty("default_portal", portal_domain)
|
600
604
|
context = rh.getContext(
|
601
605
|
self.getActiveRequest(),
|
602
606
|
member=self,
|
account/models/notify.py
CHANGED
@@ -10,6 +10,7 @@ from .member import Member
|
|
10
10
|
|
11
11
|
from datetime import datetime, timedelta
|
12
12
|
import threading
|
13
|
+
import incident
|
13
14
|
|
14
15
|
|
15
16
|
def sendEmail(email_to, subject, body=None, attachments=[],
|
@@ -110,6 +111,14 @@ class NotificationRecord(models.Model, RestModel):
|
|
110
111
|
self.state = -10
|
111
112
|
else:
|
112
113
|
self.state = -5
|
114
|
+
incident.event_now(
|
115
|
+
"email",
|
116
|
+
f"error sending email to: {email_to} - {self.subject}",
|
117
|
+
level=2,
|
118
|
+
subject=self.subject,
|
119
|
+
from_addr=self.from_addr,
|
120
|
+
to_addr=email_to,
|
121
|
+
details=self.reason)
|
113
122
|
self.save()
|
114
123
|
return True
|
115
124
|
|
@@ -28,11 +28,11 @@ account/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
28
28
|
account/models/__init__.py,sha256=cV_lMnT2vL_mjiYtT4hlcIHo52ocFbGSNVkOIHHLXZY,385
|
29
29
|
account/models/device.py,sha256=0AFeLMGk4im4KZVd3eGSyRbK4eQEXiFM2cdY8GUzihs,5934
|
30
30
|
account/models/feeds.py,sha256=vI7fG4ASY1M0Zjke24RdnfDcuWeATl_yR_25jPmT64g,2011
|
31
|
-
account/models/group.py,sha256=
|
31
|
+
account/models/group.py,sha256=N9Ow7AtV4xN5zSE9E5-msthJy0G5-3DEr2MTmvFO1kU,22887
|
32
32
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
33
|
-
account/models/member.py,sha256=
|
33
|
+
account/models/member.py,sha256=FvVUoc_n7PgqxXduQRF-S4VJcl8aER5tMBxM5xsgswU,54682
|
34
34
|
account/models/membership.py,sha256=90EpAhOsGaqphDAkONP6j_qQ0OWSRaQsI8H7E7fgMkE,9249
|
35
|
-
account/models/notify.py,sha256=
|
35
|
+
account/models/notify.py,sha256=YKYEXT56i98b7-ydLt5UuEVOqW7lipQMi-KuiPhcSwY,15627
|
36
36
|
account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
|
37
37
|
account/models/session.py,sha256=ELkWjB_2KXQvPtRPrvuGJpJsqrxCQX_4J53SbqGz_2U,3737
|
38
38
|
account/models/settings.py,sha256=gOyRWBVd3BQpjfj_hJPtqX3H46ztyRAFxBrPbv11lQg,2137
|
@@ -274,7 +274,7 @@ medialib/stores/oauth2client/tools.py,sha256=OLSW5Iu7rtjGankFpjXlHBw8aAFOcIsWdDh
|
|
274
274
|
medialib/stores/oauth2client/util.py,sha256=1Uc6qwqNhI3b507VtFnklX4sEZNt0MZbLAME2o6kCgg,5706
|
275
275
|
medialib/stores/oauth2client/xsrfutil.py,sha256=4Plq0y5xEkDwvrveVA32gBRP0A3FkJ_36dIsyGHeJeA,3367
|
276
276
|
medialib/stores/rtmpstore.py,sha256=CFRP6Ss4hbLKngbdaLvA8_oKCSe18B29-oWVgvTXMPA,500
|
277
|
-
medialib/stores/s3.py,sha256=
|
277
|
+
medialib/stores/s3.py,sha256=puXareXUmcn6KdzOcLOY24i5dJUUewe7RNIduIBou9Y,6326
|
278
278
|
medialib/stores/s3store.py,sha256=uKO6I-X83sD9xefCQytLyrV-7t9TSX2p476n_ZBkSHw,4583
|
279
279
|
medialib/stores/uritemplate/__init__.py,sha256=ONWR_KRz9au0O-XUUTrO_UN7GHTmZCTKyvflUQb8wxM,4996
|
280
280
|
medialib/stores/youtubestore.py,sha256=swXOJYfbhgzAv1NjOehjKtfYRZYk2wiPK7a7_boAulc,406
|
@@ -377,7 +377,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
377
377
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
378
378
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
379
379
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
380
|
-
rest/__init__.py,sha256=
|
380
|
+
rest/__init__.py,sha256=P7AsJG2-fQOZPMovCvkbEW57dyHqLdU0F4_ptZlHISg,122
|
381
381
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
382
382
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
383
383
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -393,7 +393,7 @@ rest/extra/hostinfo.py,sha256=5R23EafcNbFARyNEqdjBkqcpC8rPfmPd1zqNqle6-nM,4298
|
|
393
393
|
rest/extra/json_metadata.py,sha256=p_ffzmANmOFix_oC3voR6_NNTjcn7-T7aXcH-I4_Npg,1078
|
394
394
|
rest/fields.py,sha256=_v1TJVc6vyWlqmwFRJ6mtuR5Fo-lS0KcUhPWIrzKZUo,9719
|
395
395
|
rest/forms.py,sha256=66Wm5cdy8tKib_mGicjq_yd-gNVMFWRECnrDksnNnwU,6316
|
396
|
-
rest/helpers.py,sha256=
|
396
|
+
rest/helpers.py,sha256=t7smlOUzchVno-zeq7xMJIwogAR2DeSrffWxgysOHX8,29531
|
397
397
|
rest/joke.py,sha256=0PpKaX2iN7jlS62kgjfmmqkFBYLPURz15aQ8R7OJkJ8,260
|
398
398
|
rest/jwtoken.py,sha256=6AIe9IpsOn44sodiV0OPYeTZZNhS8VRiakV-rOuCyGw,2444
|
399
399
|
rest/log.py,sha256=hd1_4HBOS395sfXJIL6BTw9yekm1SLgBwYx_PdfIhKA,20930
|
@@ -513,7 +513,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
513
513
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
514
514
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
515
515
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
516
|
-
django_restit-4.2.
|
517
|
-
django_restit-4.2.
|
518
|
-
django_restit-4.2.
|
519
|
-
django_restit-4.2.
|
516
|
+
django_restit-4.2.136.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
517
|
+
django_restit-4.2.136.dist-info/METADATA,sha256=0XTqwV9RSBBDL7jfrwHLJoRI-Rr122bpMowDHQbuLCA,7663
|
518
|
+
django_restit-4.2.136.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
519
|
+
django_restit-4.2.136.dist-info/RECORD,,
|
medialib/stores/s3.py
CHANGED
@@ -12,7 +12,11 @@ from medialib import utils
|
|
12
12
|
import threading
|
13
13
|
import tempfile
|
14
14
|
|
15
|
-
S3 = objict(
|
15
|
+
S3 = objict(
|
16
|
+
KEY=settings.AWS_KEY,
|
17
|
+
SECRET=settings.AWS_SECRET,
|
18
|
+
REGSION=settings.AWS_REGION,
|
19
|
+
BUCKET=settings.AWS_S3_BUCKET)
|
16
20
|
|
17
21
|
|
18
22
|
class S3Item(object):
|
rest/__init__.py
CHANGED
rest/helpers.py
CHANGED
@@ -36,6 +36,8 @@ DEBUG_LOGGER = getLogger("debug", filename="debug.log")
|
|
36
36
|
AUDITLOG_LOGGER_BY_USER = settings.get("AUDITLOG_LOGGER_BY_USER", False)
|
37
37
|
AUDITLOG_LOGGERS = settings.get("AUDITLOG_LOGGERS", {})
|
38
38
|
HELPER_CACHE = objict()
|
39
|
+
UNKNOWN = object()
|
40
|
+
|
39
41
|
|
40
42
|
def getLoggerByRequest(request):
|
41
43
|
logger = AUDIT_LOGGER
|
@@ -277,6 +279,8 @@ def parseHostName(url, root=False):
|
|
277
279
|
parsed_url = urlparse(url)
|
278
280
|
hname = parsed_url.netloc
|
279
281
|
else:
|
282
|
+
if "/" in url:
|
283
|
+
url = url[:url.find('/')]
|
280
284
|
hname = url
|
281
285
|
if root and hname.count('.') > 1:
|
282
286
|
return hname[hname.find(".")+1:]
|
File without changes
|
File without changes
|