diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-04-24 14:16:15 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-04-24 14:16:15 -0700 |
commit | 943a48fc5c0a59b892eb746073c71b8dd88815e7 (patch) | |
tree | 421cfedbc60603d02e0b314d9204e9f85dd781c5 /py/demo/Ice/session/Server.py | |
parent | minor fix to IcePHP getLogger (diff) | |
download | ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.bz2 ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.tar.xz ice-943a48fc5c0a59b892eb746073c71b8dd88815e7.zip |
python 3 support
Diffstat (limited to 'py/demo/Ice/session/Server.py')
-rwxr-xr-x | py/demo/Ice/session/Server.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/py/demo/Ice/session/Server.py b/py/demo/Ice/session/Server.py index 3ed1642b3a4..610778c90f4 100755 --- a/py/demo/Ice/session/Server.py +++ b/py/demo/Ice/session/Server.py @@ -19,8 +19,8 @@ class HelloI(Demo.Hello): self._id = id def sayHello(self, c): - print "Hello object #" + str(self._id) + " for session `" + self._name + "' says:\n" + \ - "Hello " + self._name + "!" + print("Hello object #" + str(self._id) + " for session `" + self._name + "' says:\n" + \ + "Hello " + self._name + "!") class SessionI(Demo.Session): def __init__(self, name): @@ -31,8 +31,8 @@ class SessionI(Demo.Session): self._nextId = 0 # The id of the next hello object. This is used for tracing purposes. self._objs = [] # List of per-client allocated Hello objects. - print "The session " + self._name + " is now created." - + print("The session " + self._name + " is now created.") + def createHello(self, c): self._lock.acquire() try: @@ -63,19 +63,19 @@ class SessionI(Demo.Session): return self._name finally: self._lock.release() - + def destroy(self, c): self._lock.acquire() try: if self._destroy: raise Ice.ObjectNotExistException() self._destroy = True - print "The session " + self._name + " is now destroyed." + print("The session " + self._name + " is now destroyed.") try: c.adapter.remove(c.id) for p in self._objs: c.adapter.remove(p.ice_getIdentity()) - except Ice.ObjectAdapterDeactivatedException, ex: + except Ice.ObjectAdapterDeactivatedException as ex: # This method is called on shutdown of the server, in # which case this exception is expected. pass @@ -91,7 +91,7 @@ class SessionI(Demo.Session): return self._timestamp finally: self._lock.release() - + class SessionProxyPair: def __init__(self, p, s): self.proxy = p @@ -121,7 +121,7 @@ class ReapThread(threading.Thread): if (time.time() - p.session.timestamp()) > self._timeout: name = p.proxy.getName() p.proxy.destroy() - print "The session " + name + " has timed out." + print("The session " + name + " has timed out.") self._sessions.remove(p) except Ice.ObjectNotExistException: self._sessions.remove(p) @@ -161,13 +161,13 @@ class SessionFactoryI(Demo.SessionFactory): self._lock.release() def shutdown(self, c): - print "Shutting down..." + print("Shutting down...") c.adapter.getCommunicator().shutdown() class Server(Ice.Application): def run(self, args): if len(args) > 1: - print self.appName() + ": too many arguments" + print(self.appName() + ": too many arguments") return 1 adapter = self.communicator().createObjectAdapter("SessionFactory") |