Commit 45dbdad2 authored by Nicolas Wavrant's avatar Nicolas Wavrant

Alarm: allow chaining activities with Alarm's activeSense

activeSense() now returns the tag of the last run activity, so activeSense
can be chained with other activities.
For this, the notify() method gets its own tag. Now, when running activities
after activeSense, one is sure that it really ended.
parent 1a191b1b
......@@ -159,7 +159,11 @@ class Alarm(XMLObject, PeriodicityMixin):
# Old API
getattr(self.activate(**activate_kw), method_id)()
if self.isAlarmNotificationMode():
self.activate(after_tag=tag).notify(include_active=True, params=params)
notification_tag=self.__getTag(True)
self.activate(tag=notification_tag, after_tag=tag) \
.notify(include_active=True, params=params)
return notification_tag
return tag
# switch to nobody temporarily so that unrestricted _activeSense
# is always invoked by system user.
......@@ -170,7 +174,7 @@ class Alarm(XMLObject, PeriodicityMixin):
activate_kw = {}
try:
_activeSense()
return _activeSense()
finally:
# Restore the original user.
setSecurityManager(sm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment