~ubuntu-branches/ubuntu/oneiric/pyro/oneiric

« back to all changes in this revision

Viewing changes to examples/testmobile/passon/server/server1.py

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2007-09-01 23:12:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070901231252-veufo1dqva5oipo1
Tags: 3.7-1
* Adopting the package in the name of the Python Modules Team
  (Closes: #439048)
  - Thanks to Alexandre Fayolle and Jérémy Bobbio for the previous NMUs
    (Closes: #216731, #377680, #391808)
* New upstream version
* debian/watch:
  - Adding file
* debian/control:
  - Reflecting maintainer change
  - Adding XS-Vcs-Svn and XS-Vcs-Browser fields
  - Moving python to Build-Depends because it's used in the clean target
  - Adding dpatch to Build-Depends
  - Putting pyro-doc into the doc Section
* debian/semantic.cache:
  - Removing file, not needed for packaging pyro
* debian/setup.cfg:
  - Adding file to configure upstream's very special setup.py
* debian/rules:
  - Fixing build process to use debian/setup.cfg
  - Adding dpatch targets/include
* debian/README.Debian:
  - Removing file, explanation not needed anymore
* debian/NEWS.Debian:
  - Adding file, explaining upstream's change in the script names
* debian/patches:
  - Adding patch to cleanup/fix shebangs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
 
 
3
import sys, os
 
4
import Pyro.core
 
5
from Pyro.errors import PyroError
 
6
import Pyro.naming
 
7
 
 
8
if not Pyro.config.PYRO_MOBILE_CODE:
 
9
        print "\nWARNING: PYRO_MOBILE_CODE not enabled\n"
 
10
if Pyro.config.PYRO_XML_PICKLE=='gnosis' and Pyro.config.PYRO_GNOSIS_PARANOIA>=0:
 
11
        print "\nWARNING: Using gnosis xml pickle but PYRO_GNOSIS_PARANOIA needs to be -1\n"
 
12
 
 
13
class Test(Pyro.core.ObjBase):
 
14
        def __init__(self):
 
15
                Pyro.core.ObjBase.__init__(self)
 
16
        def method1(self, argument):
 
17
                print "method1 called on test class, arg=",argument
 
18
                try:
 
19
                        obj=Pyro.core.getProxyForURI("PYRONAME://:testmobile_passon_server2")
 
20
                        print "calling method on server2, passing on argument"
 
21
                        result="Server1 result;"
 
22
                        result+=obj.method2(argument)
 
23
                except PyroError,x:
 
24
                        print "Some error occured!",x
 
25
                        result="there was an error in server1, see the console over there"      
 
26
                print "returning result:",result
 
27
                return result
 
28
 
 
29
Pyro.core.initServer()
 
30
Pyro.core.initClient()
 
31
ns=Pyro.naming.NameServerLocator().getNS()
 
32
daemon = Pyro.core.Daemon()
 
33
daemon.useNameServer(ns)
 
34
objectName=':testmobile_passon_server1'
 
35
uri=daemon.connect(Test(),objectName)
 
36
 
 
37
# enter the service loop.
 
38
print 'Server1 is ready for customers.'
 
39
daemon.requestLoop()
 
40