/usr/share/doc/sanduhr/examples/ex-delivery-fail.py is in sanduhr 1.93-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #! /usr/bin/env python
"""ex-delivery-failed.py - Signalling delivery errors
This example shows how an alarm action should
signal delivery errors."""
import CORBA, oaf
import SandUhr, SandUhr__POA
orb = oaf.init()
class BrokenAlarm(SandUhr__POA.AlarmAction):
def __init__(self):
self.NeedsPopup = CORBA.FALSE
def Attach(self, timer):
pass
def Detach(self, timer):
orb.shutdown(1)
def Deliver(self, timespec, message):
raise SandUhr.AlarmAction.DeliveryFailed(Reason="recipient unknown")
poa = orb.resolve_initial_references("RootPOA")
alarm = BrokenAlarm()._this()
poa._get_the_POAManager().activate()
factory = oaf.activate("repo_ids.has('IDL:SandUhr/TimerFactory:1.0')",[])
timer = factory.CreateTimer ("+10s", "The example timer has reached its time")
timer.Alarm = alarm
orb.run()
|