File: server2.py

package info (click to toggle)
pyro5 5.15-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,112 kB
  • sloc: python: 14,291; makefile: 163; sh: 66; javascript: 62
file content (27 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (2)
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
from Pyro5.api import expose, oneway, serve
import Pyro5.errors


class CallbackServer(object):
    @expose
    @oneway
    def doCallback(self, callback):
        print("\n\nserver: doing callback 1 to client")
        callback._pyroClaimOwnership()
        try:
            callback.call1()
        except Exception:
            print("got an exception from the callback:")
            print("".join(Pyro5.errors.get_pyro_traceback()))
        print("\n\nserver: doing callback 2 to client")
        try:
            callback.call2()
        except Exception:
            print("got an exception from the callback:")
            print("".join(Pyro5.errors.get_pyro_traceback()))
        print("server: callbacks done.\n")


serve({
    CallbackServer: "example.callback2"
})