simo 2.7.19__py3-none-any.whl → 2.7.20__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 simo might be problematic. Click here for more details.

simo/core/tasks.py CHANGED
@@ -476,8 +476,13 @@ def maybe_update_to_latest():
476
476
  if resp.status_code != 200:
477
477
  print("Bad response from server")
478
478
  return
479
- latest = list(resp.json()['releases'].keys())[-1]
480
- dynamic_settings['core__latest_version_available'] = latest
479
+
480
+ versions = list(resp.json()['releases'].keys())
481
+ def version_no(v):
482
+ major, minor, patch = v.split('.')
483
+ return int(major) * 1000000 + int(minor) * 1000 + int(patch)
484
+ versions.sort(reverse=True, key=version_no)
485
+ dynamic_settings['core__latest_version_available'] = versions[0]
481
486
 
482
487
  try:
483
488
  version = pkg_resources.get_distribution('simo').version
simo/users/models.py CHANGED
@@ -216,7 +216,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
216
216
  REQUIRED_FIELDS = ['name']
217
217
 
218
218
 
219
-
220
219
  class Meta:
221
220
  verbose_name = _('user')
222
221
  verbose_name_plural = _('users')
@@ -225,8 +224,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
225
224
  def __init__(self, *args, **kwargs):
226
225
  super().__init__(*args, **kwargs)
227
226
  self._is_active = None
228
- self._instances = None
229
- self._instance_roles = {}
230
227
 
231
228
  def __str__(self):
232
229
  return self.name
@@ -270,8 +267,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
270
267
  return self.is_active and self.is_master
271
268
 
272
269
  def get_role(self, instance):
273
- if instance.id in self._instance_roles:
274
- return self._instance_roles[instance.id]
275
270
  cache_key = f'user-{self.id}_instance-{instance.id}_role'
276
271
  role = cache.get(cache_key)
277
272
  if role is None:
@@ -282,8 +277,7 @@ class User(AbstractBaseUser, SimoAdminMixin):
282
277
  ).first()
283
278
  if role:
284
279
  cache.set(cache_key, role, 20)
285
- self._instance_roles[instance.id] = role
286
- return self._instance_roles[instance.id]
280
+ return role
287
281
 
288
282
  @property
289
283
  def role_id(self):
@@ -329,8 +323,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
329
323
  from simo.core.models import Instance
330
324
  if not self.is_active:
331
325
  return Instance.objects.none()
332
- if self._instances != None:
333
- return self._instances
334
326
 
335
327
  cache_key = f'user-{self.id}_instances'
336
328
  instances = cache.get(cache_key)
@@ -344,8 +336,8 @@ class User(AbstractBaseUser, SimoAdminMixin):
344
336
  )
345
337
  ], is_active=True)
346
338
  cache.set(cache_key, instances, 10)
347
- self._instances = instances
348
- return self._instances
339
+
340
+ return instances
349
341
 
350
342
  @property
351
343
  def component_permissions(self):
@@ -356,8 +348,6 @@ class User(AbstractBaseUser, SimoAdminMixin):
356
348
 
357
349
  @property
358
350
  def is_active(self):
359
- if self._is_active != None:
360
- return self._is_active
361
351
  cache_key = f'user-{self.id}_is_active'
362
352
  cached_value = cache.get(cache_key)
363
353
  if cached_value is None:
@@ -383,9 +373,7 @@ class User(AbstractBaseUser, SimoAdminMixin):
383
373
  self.instance_roles.filter(is_active=True).count()
384
374
  )
385
375
  cache.set(cache_key, cached_value, 20)
386
-
387
- self._is_active = cached_value
388
- return self._is_active
376
+ return cached_value
389
377
 
390
378
 
391
379
  @is_active.setter
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simo
3
- Version: 2.7.19
3
+ Version: 2.7.20
4
4
  Summary: Smart Home on Steroids!
5
5
  Author-email: Simanas Venčkauskas <simanas@simo.io>
6
6
  Project-URL: Homepage, https://simo.io
@@ -114,7 +114,7 @@ simo/core/serializers.py,sha256=jimqPhL2mq5_dJWtv6P1qErFMaNMizsAS2E_aYkAiQU,2320
114
114
  simo/core/signal_receivers.py,sha256=5qp607PdNlRHyw88YOXu7rSznHm3upEpWLxB0lmEa0s,6527
115
115
  simo/core/socket_consumers.py,sha256=Es_NmacQGZjsncBXDTEXR2yZbRs7mf2FKOBJjbZRGac,9607
116
116
  simo/core/storage.py,sha256=_5igjaoWZAiExGWFEJMElxUw55DzJG1jqFty33xe8BE,342
117
- simo/core/tasks.py,sha256=LMTkZQDGFus5L2Q8AGzYegjpnZKf9Klgo3V9BT5L2ng,16904
117
+ simo/core/tasks.py,sha256=-yBjOPILEnKRga-6MK-hBpEINQcY5mpwZwUWiDpqISs,17091
118
118
  simo/core/todos.py,sha256=eYVXfLGiapkxKK57XuviSNe3WsUYyIWZ0hgQJk7ThKo,665
119
119
  simo/core/types.py,sha256=WJEq48mIbFi_5Alt4wxWMGXxNxUTXqfQU5koH7wqHHI,1108
120
120
  simo/core/views.py,sha256=08H4Bm7KrHxB3p3ZKx1vrFR4d0DjCqMbqQosEsRWpkY,2841
@@ -10741,7 +10741,7 @@ simo/users/auto_urls.py,sha256=RSUW3ai5LbMTknS8M7M5aOnG_YlFOVQrnNVNH-fkwlg,357
10741
10741
  simo/users/dynamic_settings.py,sha256=sEIsi4yJw3kH46Jq_aOkSuK7QTfQACGUE-lkyBogCaM,570
10742
10742
  simo/users/managers.py,sha256=OHgEP85MBtdkdYxdstBd8RavTBT8F_2WyDxUJ9aCqqM,246
10743
10743
  simo/users/middleware.py,sha256=GMCrnWSc_2qCleyQIkfQGdL-pU-UTEcSg1wPvIKZ9uk,1210
10744
- simo/users/models.py,sha256=qTlhML4zRfL_Gcomblc09GU1xWDa4DOwbFaxCgd_rsE,20563
10744
+ simo/users/models.py,sha256=GFTMfs7dC6XXmvot7WLcjyH0WqowNU9zbLD9oE0_3Yg,20092
10745
10745
  simo/users/permissions.py,sha256=IwtYS8yQdupWbYKR9VimSRDV3qCJ2jXP57Lyjpb2EQM,242
10746
10746
  simo/users/serializers.py,sha256=zzw1KONTnaTNBaU0r4rNVxJ827KzD6Z5LuQt27ZsQ98,2516
10747
10747
  simo/users/sso_urls.py,sha256=gQOaPvGMYFD0NCVSwyoWO-mTEHe5j9sbzV_RK7kdvp0,251
@@ -10924,9 +10924,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10924
10924
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10925
10925
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10926
10926
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10927
- simo-2.7.19.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10928
- simo-2.7.19.dist-info/METADATA,sha256=WpsPW7Q5XwQTjshoHvQuwLUip5VdvIa4JBLhqUXXVBE,2009
10929
- simo-2.7.19.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
10930
- simo-2.7.19.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10931
- simo-2.7.19.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10932
- simo-2.7.19.dist-info/RECORD,,
10927
+ simo-2.7.20.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10928
+ simo-2.7.20.dist-info/METADATA,sha256=aVspt7f-xasumTf7jkxZRQi1qERai_kgs1wGTM6MKtI,2009
10929
+ simo-2.7.20.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
10930
+ simo-2.7.20.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10931
+ simo-2.7.20.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10932
+ simo-2.7.20.dist-info/RECORD,,
File without changes