simo 2.8.6__py3-none-any.whl → 2.8.9__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/controllers.py CHANGED
@@ -275,6 +275,7 @@ class ControllerBase(ABC):
275
275
  self.component.value = value
276
276
 
277
277
  def set(self, value, actor=None):
278
+ from simo.users.models import InstanceUser
278
279
  if self.component.value_translation:
279
280
  try:
280
281
  namespace = {}
@@ -289,20 +290,36 @@ class ControllerBase(ABC):
289
290
  actor = self._get_actor(value)
290
291
  if not actor:
291
292
  actor = get_current_user()
292
- if actor:
293
- introduce_user(actor)
294
293
 
295
294
  self.component.refresh_from_db()
296
295
  if value != self.component.value:
297
296
  self.component.value_previous = self.component.value
297
+ from .models import ComponentHistory
298
+ ComponentHistory.objects.create(
299
+ component=self.component, type='value', value=value,
300
+ user=actor
301
+ )
302
+ from actstream import action
303
+ action.send(
304
+ actor, target=self.component, verb="value change",
305
+ instance_id=self.component.zone.instance.id,
306
+ action_type='comp_value', value=value
307
+ )
308
+ actor.last_action = timezone.now()
309
+ actor.save()
298
310
  self.component.value = value
299
-
300
311
  self.component.change_init_by = None
301
312
  self.component.change_init_date = None
302
313
  self.component.change_init_to = None
303
314
  self.component.change_init_fingerprint = None
315
+ self.component.change_actor = InstanceUser.objects.filter(
316
+ instance=self.component.zone.instance,
317
+ user=actor
318
+ ).first()
304
319
  self.component.save()
305
320
 
321
+
322
+
306
323
  def _receive_from_device(
307
324
  self, value, is_alive=True, battery_level=None, error_msg=None
308
325
  ):
@@ -314,9 +331,6 @@ class ControllerBase(ABC):
314
331
  init_by_device = True
315
332
  actor = get_device_user()
316
333
 
317
- # Introducing user to this thread for changes that might happen to other components
318
- # in relation to the change of this component
319
- introduce_user(actor)
320
334
  self.component.alive = is_alive
321
335
  if error_msg != None:
322
336
  self.component.error_msg = error_msg if error_msg.strip() else None
simo/core/events.py CHANGED
@@ -131,16 +131,16 @@ class OnChangeMixin:
131
131
 
132
132
  self.refresh_from_db()
133
133
 
134
- if inspect.getfullargspec(self._on_change_function).args:
135
- try:
136
- self._on_change_function(self)
137
- except Exception:
138
- print(traceback.format_exc(), file=sys.stderr)
139
- else:
140
- try:
141
- self._on_change_function()
142
- except Exception:
143
- print(traceback.format_exc(), file=sys.stderr)
134
+ no_args = len(inspect.getfullargspec(self._on_change_function).args)
135
+ args = []
136
+ if no_args > 0:
137
+ args = [self]
138
+ if no_args > 1:
139
+ args.append(payload.get('actor'))
140
+ try:
141
+ self._on_change_function(*args)
142
+ except Exception:
143
+ print(traceback.format_exc(), file=sys.stderr)
144
144
 
145
145
  def on_change(self, function):
146
146
  if function:
simo/core/models.py CHANGED
@@ -510,18 +510,7 @@ def is_in_alarm(self):
510
510
 
511
511
  if self.pk:
512
512
  actor = get_current_user()
513
- action_performed = False
514
- if 'value' in dirty_fields:
515
- ComponentHistory.objects.create(
516
- component=self, type='value', value=self.value,
517
- user=actor
518
- )
519
- action.send(
520
- actor, target=self, verb="value change",
521
- instance_id=self.zone.instance.id,
522
- action_type='comp_value', value=self.value
523
- )
524
- action_performed = True
513
+
525
514
  if 'arm_status' in dirty_fields:
526
515
  ComponentHistory.objects.create(
527
516
  component=self, type='security',
@@ -533,7 +522,6 @@ def is_in_alarm(self):
533
522
  action_type='security', value=self.value
534
523
  )
535
524
  action_performed = True
536
- if action_performed:
537
525
  actor.last_action = timezone.now()
538
526
  actor.save()
539
527
 
@@ -164,6 +164,7 @@ def post_save_change_events(sender, instance, created, **kwargs):
164
164
  ObjectChangeEvent(
165
165
  target.zone.instance, target,
166
166
  dirty_fields=dirty_fields,
167
+ actor=getattr(target, 'change_actor', None),
167
168
  **data
168
169
  ).publish()
169
170
  for master in target.masters.all():
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simo
3
- Version: 2.8.6
3
+ Version: 2.8.9
4
4
  Summary: Smart Home Supremacy
5
5
  Author-email: Simanas Venčkauskas <simanas@simo.io>
6
6
  Project-URL: Homepage, https://simo.io
@@ -98,9 +98,9 @@ simo/core/auto_urls.py,sha256=FqKhH0fF7cGO6P2YrjblwG4JA2UkVXj3lreJUOB2Jq4,1194
98
98
  simo/core/autocomplete_views.py,sha256=x3MKOZvXYS3xVQ-V1S7Liv_U5bxr-uc0gePa85wv5nA,4561
99
99
  simo/core/base_types.py,sha256=WypW8hTfzveuTQtruGjLYAGQZIuczxTlW-SdRk3iQug,666
100
100
  simo/core/context.py,sha256=LKw1I4iIRnlnzoTCuSLLqDX7crHdBnMo3hjqYvVmzFc,1557
101
- simo/core/controllers.py,sha256=4u67VNwU4Zts64aVddqhoPt9ZRbpTmAHPCdu-pFfIX0,37407
101
+ simo/core/controllers.py,sha256=P4D0Tw1_t0CGM3JzRRMdyW9941xxrMsJVwikJz62ffE,37928
102
102
  simo/core/dynamic_settings.py,sha256=bUs58XEZOCIEhg1TigR3LmYggli13KMryBZ9pC7ugAQ,1872
103
- simo/core/events.py,sha256=1_KIk5pJqdLPRQlCQ9xSyALst2Cn0b2lAEAJ3QjwIjE,4801
103
+ simo/core/events.py,sha256=YkTtkhJJ1MlSarTZ8qhZYMB3ZI7e5-7sK9A0SgVNQYA,4768
104
104
  simo/core/filters.py,sha256=6wbn8C2WvKTTjtfMwwLBp2Fib1V0-DMpS4iqJd6jJQo,2540
105
105
  simo/core/form_fields.py,sha256=b4wZ4n7OO0m0_BPPS9ILVrwBvhhjUB079YrroveFUWA,5222
106
106
  simo/core/forms.py,sha256=D56T38VIdqWXHJ3fW4_jQdxX40YOR8l7ynfWSm8Q1W0,22011
@@ -108,11 +108,11 @@ simo/core/gateways.py,sha256=Y2BME6zSyeUq_e-hzEUF6gErCUCP6nFxedkLZKiLVOo,4141
108
108
  simo/core/loggers.py,sha256=EBdq23gTQScVfQVH-xeP90-wII2DQFDjoROAW6ggUP4,1645
109
109
  simo/core/managers.py,sha256=Ampwe5K7gfE6IJULNCV35V8ysmMOdS_wz7mRzfaLZUw,3014
110
110
  simo/core/middleware.py,sha256=zX6N4P_KR7gG8N2-NcR7jKtuCEhCGRh51g4EktAhP7w,3272
111
- simo/core/models.py,sha256=Nw-XT0v0y5pBYlKKhzoI68HiEMMTp7fqZQZgKmeOW7Q,23752
111
+ simo/core/models.py,sha256=brZPs8clR49VKm_Uo1wgPgCbjkS0fTLvzz3rROBeob4,23211
112
112
  simo/core/permissions.py,sha256=Ef4NO7QwwDd3Z-v61R0BeCBXxTOJz9qBvzRTIB5tHwI,2943
113
113
  simo/core/routing.py,sha256=X1_IHxyA-_Q7hw1udDoviVP4_FSBDl8GYETTC2zWTbY,499
114
114
  simo/core/serializers.py,sha256=adqe8oYP5f7hGFXcxa-Zmce2KOwy3hZOaWE3MaAFtpM,23157
115
- simo/core/signal_receivers.py,sha256=tSHKGEFbGqfD-WNKnbDjOQRoABII4akB2oj7l_gLRWk,6517
115
+ simo/core/signal_receivers.py,sha256=eBz-K81W150mavnVzVPU6z8VU_BCqX33O066Xwo8gXw,6578
116
116
  simo/core/socket_consumers.py,sha256=UlxV9OvTUUXaoKKYT3-qf1TyGxyOPxIpFH5cPFepH1o,9584
117
117
  simo/core/storage.py,sha256=_5igjaoWZAiExGWFEJMElxUw55DzJG1jqFty33xe8BE,342
118
118
  simo/core/tasks.py,sha256=-yBjOPILEnKRga-6MK-hBpEINQcY5mpwZwUWiDpqISs,17091
@@ -142,11 +142,11 @@ simo/core/__pycache__/base_types.cpython-312.pyc,sha256=Lnq2NL9B5hfwJARJYC447Rdv
142
142
  simo/core/__pycache__/base_types.cpython-38.pyc,sha256=CX-qlF7CefRi_mCE954wYa9rUFR88mOl6g7fybDRu7g,803
143
143
  simo/core/__pycache__/context.cpython-312.pyc,sha256=8rsN2Er-Sx3rrVmO0Gk4cem3euGh0kTELXj667GGZ5E,2193
144
144
  simo/core/__pycache__/context.cpython-38.pyc,sha256=NlTHt2GvXxA21AhBkeyOLfRFUuXw7wmwqyNhhcDl2cw,1373
145
- simo/core/__pycache__/controllers.cpython-312.pyc,sha256=pNjKIaSvzEWJlI6_yQdmakyFYNgrxv6dyexVvoScUj4,52897
145
+ simo/core/__pycache__/controllers.cpython-312.pyc,sha256=BjN6TuuqdShWbEFHdZXSdZFB4CwstDJa8LZ1YCe46a0,53852
146
146
  simo/core/__pycache__/controllers.cpython-38.pyc,sha256=LtrQQ8egOIOuQbAckeM-z8OfbzS4W8VQ3vBnryAm3iU,32086
147
147
  simo/core/__pycache__/dynamic_settings.cpython-312.pyc,sha256=WUZ6XF4kZb6zPf541PkKmiQaBIw-r5C6F3EUUZiTEnE,3331
148
148
  simo/core/__pycache__/dynamic_settings.cpython-38.pyc,sha256=wGpnscX1DxFpRl54MQURhjz2aD3NJohSzw9JCFnzh2Y,2384
149
- simo/core/__pycache__/events.cpython-312.pyc,sha256=G7ayf6HKwjsd6dOUn_TT9JsJsq8KAg7RzCMANqjnZEc,8927
149
+ simo/core/__pycache__/events.cpython-312.pyc,sha256=XMi5fRd97IFEH5wwCJEqUMPtpv_0xJgWr4wqjT7SasU,8900
150
150
  simo/core/__pycache__/events.cpython-38.pyc,sha256=1y8YaZsiDkBOeIWzH7SQz4holmMG_RLlMWi8kuSZcoE,5280
151
151
  simo/core/__pycache__/filters.cpython-312.pyc,sha256=-vgZ2km1A2q4Un1i30fgHT-6rROgso7HJyd7ct2coJI,3640
152
152
  simo/core/__pycache__/filters.cpython-38.pyc,sha256=WBBDwcDQwOmgbrRhyUxenSN80rU4Eq9jQ6RcrRGCP_o,2440
@@ -162,7 +162,7 @@ simo/core/__pycache__/managers.cpython-312.pyc,sha256=RpeR1Z0GtSZht4_a4iDfTU_E8P
162
162
  simo/core/__pycache__/managers.cpython-38.pyc,sha256=6RTIxyjOgpQGtAqcUyE2vFPS09w1V5Wmd_vOV7rHRRI,3370
163
163
  simo/core/__pycache__/middleware.cpython-312.pyc,sha256=2VhHTVY-rdPNqNX0wst2ioVbHD5uMqHkY-tpujLdpH0,4195
164
164
  simo/core/__pycache__/middleware.cpython-38.pyc,sha256=SgTLFNkKxvJ62hevSAVNZHgHdG_u2p7AZBhrj-jfFPs,2649
165
- simo/core/__pycache__/models.cpython-312.pyc,sha256=z6RR7Rv4POCpVl5acn2VHVhLLRh59YhO1jq_JSO8CmI,31960
165
+ simo/core/__pycache__/models.cpython-312.pyc,sha256=C1whcLl5R_kD5HDfQhtM5WfK8NlsB6_wIqR-Zem9mLk,31570
166
166
  simo/core/__pycache__/models.cpython-38.pyc,sha256=A4JsWsDMBaQ_U5sV5cX0c_Uox9mP5fAqn_712EjfNS4,19605
167
167
  simo/core/__pycache__/permissions.cpython-312.pyc,sha256=yqG6t9NZZtL30Hr7razjiG6JDGKiz0Qjcjxgv1C93vM,4450
168
168
  simo/core/__pycache__/permissions.cpython-38.pyc,sha256=UdtxCTXPEbe99vgZOfRz9wfKSYvUn9hSRbpIV9CJSyI,2988
@@ -170,7 +170,7 @@ simo/core/__pycache__/routing.cpython-312.pyc,sha256=bDvF5HTZ8POSOHKwREyhSPO7oh9
170
170
  simo/core/__pycache__/routing.cpython-38.pyc,sha256=3T3FPJ8Cn99xZCGvMyg2xjl7al-Shm9CelbSpkJtNP8,599
171
171
  simo/core/__pycache__/serializers.cpython-312.pyc,sha256=LW6xmjKG5Ex5y8kslVd2xGy9eRqjNP2E29GxdJaAq48,32997
172
172
  simo/core/__pycache__/serializers.cpython-38.pyc,sha256=H3K_retN44wOj-ew0cvoxUSXqrUOhHCMV_oJabNF0Xg,20431
173
- simo/core/__pycache__/signal_receivers.cpython-312.pyc,sha256=aSU_K0X2heDJL7DM8zGrjj4JqcNBgkwY_dIMiMWJI2I,8942
173
+ simo/core/__pycache__/signal_receivers.cpython-312.pyc,sha256=5ahQ8vCFy7-mCeptOPEv10vUzJe-Hk31fzuAjaBNDPc,8999
174
174
  simo/core/__pycache__/signal_receivers.cpython-38.pyc,sha256=R_h1GHkoZXR-nrwiRJWQ9xE69JB1R_mP_fNYIBX4lrE,5165
175
175
  simo/core/__pycache__/socket_consumers.cpython-312.pyc,sha256=Yph9SQTj6c3xr2HXKnSm7r2M7dp1ks2lp8Q6v8TJ7cM,15322
176
176
  simo/core/__pycache__/socket_consumers.cpython-38.pyc,sha256=Mr1-x-vGjBNffbz0S6AKpJCuzHJgRm8kXefv3qVVY_E,8397
@@ -10763,7 +10763,7 @@ simo/users/__pycache__/admin.cpython-312.pyc,sha256=lTVuZQwkuw1bzSn0A0kt-8H6ruKa
10763
10763
  simo/users/__pycache__/admin.cpython-38.pyc,sha256=uL8TwAipkatZxanvQtBKKcOv8Fm3UvinBxsP0okrOZg,8443
10764
10764
  simo/users/__pycache__/api.cpython-312.pyc,sha256=p8nEOe95slqWK0QxhAkmXXbyPiZd-0VcA-ejvFcS6Mo,18333
10765
10765
  simo/users/__pycache__/api.cpython-38.pyc,sha256=zZ4DfNktgeVvLAtMpaPUv7AoAgbKr7SCt-4ghJk1zp4,10386
10766
- simo/users/__pycache__/apps.cpython-312.pyc,sha256=yLvyvcBuRr6jfIxwiA9sjQOE4VyHVUKl5FUVDPXuAkM,707
10766
+ simo/users/__pycache__/apps.cpython-312.pyc,sha256=6KefztC11cSg6VHJ7-sVDvOA-oq_jNMB8jMvmhcVZD4,707
10767
10767
  simo/users/__pycache__/apps.cpython-38.pyc,sha256=dgbWL8CxzzISJQTmq_4IztPJ2UzykNVdqA2Ae1PmeGk,605
10768
10768
  simo/users/__pycache__/auth_backends.cpython-312.pyc,sha256=63popQIO8sxcaOGOWxol_5RpKNbYiQhJtPEWEm31xc4,5469
10769
10769
  simo/users/__pycache__/auth_backends.cpython-38.pyc,sha256=jYS2hlbTZh_ZtPeWcN50pc0IpyfCSO7_MvIbuVwEp8M,3144
@@ -10933,9 +10933,9 @@ simo/users/templates/invitations/expired_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCe
10933
10933
  simo/users/templates/invitations/expired_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10934
10934
  simo/users/templates/invitations/taken_msg.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10935
10935
  simo/users/templates/invitations/taken_suggestion.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10936
- simo-2.8.6.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10937
- simo-2.8.6.dist-info/METADATA,sha256=mFNkzajYfWS7t90qazcDEGula2-oxIgJyKptnT7M4DY,2005
10938
- simo-2.8.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10939
- simo-2.8.6.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10940
- simo-2.8.6.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10941
- simo-2.8.6.dist-info/RECORD,,
10936
+ simo-2.8.9.dist-info/LICENSE.md,sha256=M7wm1EmMGDtwPRdg7kW4d00h1uAXjKOT3HFScYQMeiE,34916
10937
+ simo-2.8.9.dist-info/METADATA,sha256=OfOi51AIAYPieYx4Q2xWSE2j04nlW_U7PHkheouo6Xo,2005
10938
+ simo-2.8.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10939
+ simo-2.8.9.dist-info/entry_points.txt,sha256=S9PwnUYmTSW7681GKDCxUbL0leRJIaRk6fDQIKgbZBA,135
10940
+ simo-2.8.9.dist-info/top_level.txt,sha256=GmS1hrAbpVqn9OWZh6UX82eIOdRLgYA82RG9fe8v4Rs,5
10941
+ simo-2.8.9.dist-info/RECORD,,
File without changes