diff options
Diffstat (limited to 'py/demo/IceStorm/clock/Publisher.py')
-rw-r--r-- | py/demo/IceStorm/clock/Publisher.py | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/py/demo/IceStorm/clock/Publisher.py b/py/demo/IceStorm/clock/Publisher.py index 118aaa585e8..ab0af650156 100644 --- a/py/demo/IceStorm/clock/Publisher.py +++ b/py/demo/IceStorm/clock/Publisher.py @@ -15,46 +15,46 @@ import Demo class Publisher(Ice.Application): def run(self, args): - properties = self.communicator().getProperties() - - manager = IceStorm.TopicManagerPrx.checkedCast(\ - self.communicator().propertyToProxy('IceStorm.TopicManager.Proxy')) - if not manager: - print args[0] + ": invalid proxy" - return False - - topicName = "time" - if len(args) != 1: - topicName = args[1] - - # - # Retrieve the topic. - # - try: - topic = manager.retrieve(topicName) - except IceStorm.NoSuchTopic, e: - try: - topic = manager.create(topicName) - except IceStorm.TopicExists, ex: - print self.appName() + ": temporay error. try again" - return False - - # - # Get the topic's publisher object, the Clock type, and create a - # oneway Clock proxy (for efficiency reasons). - # - clock = Demo.ClockPrx.uncheckedCast(topic.getPublisher().ice_oneway()) - - print "publishing tick events. Press ^C to terminate the application." - try: - while 1: - clock.tick(time.strftime("%m/%d/%Y %H:%M:%S")) - time.sleep(1) - except Ice.CommunicatorDestroyedException, e: - # Ignore - pass - - return True + properties = self.communicator().getProperties() + + manager = IceStorm.TopicManagerPrx.checkedCast(\ + self.communicator().propertyToProxy('IceStorm.TopicManager.Proxy')) + if not manager: + print args[0] + ": invalid proxy" + return False + + topicName = "time" + if len(args) != 1: + topicName = args[1] + + # + # Retrieve the topic. + # + try: + topic = manager.retrieve(topicName) + except IceStorm.NoSuchTopic, e: + try: + topic = manager.create(topicName) + except IceStorm.TopicExists, ex: + print self.appName() + ": temporay error. try again" + return False + + # + # Get the topic's publisher object, the Clock type, and create a + # oneway Clock proxy (for efficiency reasons). + # + clock = Demo.ClockPrx.uncheckedCast(topic.getPublisher().ice_oneway()) + + print "publishing tick events. Press ^C to terminate the application." + try: + while 1: + clock.tick(time.strftime("%m/%d/%Y %H:%M:%S")) + time.sleep(1) + except Ice.CommunicatorDestroyedException, e: + # Ignore + pass + + return True app = Publisher() sys.exit(app.main(sys.argv, "config.pub")) |