~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to doc/howto/listings/pb/trap_server.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-01-16 19:56:10 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060116195610-ykmxbia4mnnod9o2
Tags: 2.1.0-0ubuntu2
debian/copyright: Include copyright for python 2.3; some 2.3 files
are included in the upstream tarball, but not in the binary packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/python
 
2
 
 
3
from twisted.internet import reactor
 
4
from twisted.spread import pb
 
5
 
 
6
class MyException(pb.Error):
 
7
    pass
 
8
 
 
9
class One(pb.Root):
 
10
    def remote_fooMethod(self, arg):
 
11
        if arg == "panic!":
 
12
            raise MyException
 
13
        return "response"
 
14
    def remote_shutdown(self):
 
15
        reactor.stop()
 
16
 
 
17
reactor.listenTCP(8800, pb.PBServerFactory(One()))
 
18
reactor.run()