~ubuntu-branches/debian/sid/pyro/sid

« back to all changes in this revision

Viewing changes to examples/testmobile/bothways/server/server.py

  • Committer: Bazaar Package Importer
  • Author(s): Carl Chenet, Carl Chenet, Jakub Wilk
  • Date: 2010-09-14 01:04:28 UTC
  • Revision ID: james.westby@ubuntu.com-20100914010428-02r7p1rzr7jvw94z
Tags: 1:3.9.1-2
[Carl Chenet]
* revert to 3.9.1-1 package because of the development status 
  of the 4.1 package is unsuitable for stable use
  DPMT svn #8557 revision (Closes: #589172) 
* added debian/source
* added debian/source/format
* package is now 3.0 (quilt) source format
* debian/control
  - Bump Standards-Version to 3.9.1

[Jakub Wilk]
* Add ‘XS-Python-Version: >= 2.5’ to prevent bytecompilation with python2.4
  (closes: #589053).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
#
 
4
#       The server that doesn't use the Name Server.
 
5
#
 
6
 
 
7
import sys, os
 
8
import Pyro.core
 
9
from Pyro.errors import PyroError
 
10
import serverparams.parameters
 
11
 
 
12
if not Pyro.config.PYRO_MOBILE_CODE:
 
13
        print "\nWARNING: PYRO_MOBILE_CODE not enabled\n"
 
14
if Pyro.config.PYRO_XML_PICKLE=='gnosis' and Pyro.config.PYRO_GNOSIS_PARANOIA>=0:
 
15
        print "\nWARNING: Using gnosis xml pickle but PYRO_GNOSIS_PARANOIA needs to be -1\n"
 
16
 
 
17
class Test(Pyro.core.ObjBase):
 
18
        def __init__(self):
 
19
                Pyro.core.ObjBase.__init__(self)
 
20
        def method(self, argument):
 
21
                print "some method called on test class, arg=",argument
 
22
                print "calling method on the passed object..."
 
23
                argument.method()
 
24
                # create object of a type that that client does not know about,
 
25
                # so Pyro's mobile code featuer will also pass the (module)code
 
26
                # back to the client.
 
27
                return serverparams.parameters.ServerResult("server arg")
 
28
 
 
29
Pyro.core.initServer()
 
30
daemon = Pyro.core.Daemon()
 
31
objectName='testmobile.bothways'
 
32
uri=daemon.connect(Test(),objectName)
 
33
 
 
34
# enter the service loop.
 
35
print 'Server is ready for customers. I am not using the Name Server.'
 
36
print 'Object name is:',objectName
 
37
print 'The URI is: ',uri
 
38
 
 
39
daemon.requestLoop()
 
40