diff options
Diffstat (limited to 'py/demo/IceGrid/simple')
-rw-r--r-- | py/demo/IceGrid/simple/Client.py | 54 | ||||
-rw-r--r-- | py/demo/IceGrid/simple/Server.py | 12 |
2 files changed, 33 insertions, 33 deletions
diff --git a/py/demo/IceGrid/simple/Client.py b/py/demo/IceGrid/simple/Client.py index c0dad5d49b4..7651802c658 100644 --- a/py/demo/IceGrid/simple/Client.py +++ b/py/demo/IceGrid/simple/Client.py @@ -26,39 +26,39 @@ x: exit class Client(Ice.Application): def run(self, args): hello = None - try: - hello = Demo.HelloPrx.checkedCast(self.communicator().stringToProxy("hello")) - except Ice.NotRegisteredException: - query = IceGrid.QueryPrx.checkedCast(self.communicator().stringToProxy("DemoIceGrid/Query")) - hello = Demo.HelloPrx.checkedCast(query.findObjectByType("::Demo::Hello")) + try: + hello = Demo.HelloPrx.checkedCast(self.communicator().stringToProxy("hello")) + except Ice.NotRegisteredException: + query = IceGrid.QueryPrx.checkedCast(self.communicator().stringToProxy("DemoIceGrid/Query")) + hello = Demo.HelloPrx.checkedCast(query.findObjectByType("::Demo::Hello")) - if not hello: - print self.appName() + ": couldn't find a `::Demo::Hello' object." - return False + if not hello: + print self.appName() + ": couldn't find a `::Demo::Hello' object." + return False - menu() + menu() - c = None - while c != 'x': - try: - c = raw_input("==> ") - if c == 't': - hello.sayHello() - elif c == 's': - hello.shutdown() - elif c == 'x': - pass # Nothing to do - elif c == '?': - menu() - else: - print "unknown command `" + c + "'" - menu() - except EOFError: - break + c = None + while c != 'x': + try: + c = raw_input("==> ") + if c == 't': + hello.sayHello() + elif c == 's': + hello.shutdown() + elif c == 'x': + pass # Nothing to do + elif c == '?': + menu() + else: + print "unknown command `" + c + "'" + menu() + except EOFError: + break except KeyboardInterrupt: break - return True + return True app = Client() sys.exit(app.main(sys.argv, "config.client")) diff --git a/py/demo/IceGrid/simple/Server.py b/py/demo/IceGrid/simple/Server.py index 973e3cb415e..bf2dc212601 100644 --- a/py/demo/IceGrid/simple/Server.py +++ b/py/demo/IceGrid/simple/Server.py @@ -27,12 +27,12 @@ class HelloI(Demo.Hello): class Server(Ice.Application): def run(self, args): properties = self.communicator().getProperties() - adapter = self.communicator().createObjectAdapter("Hello") - id = self.communicator().stringToIdentity(properties.getProperty("Identity")) - adapter.add(HelloI(properties.getProperty("Ice.ServerId")), id) - adapter.activate() - self.communicator().waitForShutdown() - return 0 + adapter = self.communicator().createObjectAdapter("Hello") + id = self.communicator().stringToIdentity(properties.getProperty("Identity")) + adapter.add(HelloI(properties.getProperty("Ice.ServerId")), id) + adapter.activate() + self.communicator().waitForShutdown() + return 0 app = Server() sys.exit(app.main(sys.argv)) |