/usr/share/doc/pyro4/examples/circular/chain.py is in pyro4-examples 4.23-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from __future__ import print_function
import Pyro4
# a Chain member. Passes messages to the next link,
# until the message went full-circle: then it exits.
class Chain(object):
def __init__(self, name, next):
self.name=name
self.nextName=next
self.next=None
def process(self,message):
if self.next is None:
self.next=Pyro4.core.Proxy("PYRONAME:example.chain."+self.nextName)
if self.name in message:
print("Back at %s; we completed the circle!" % self.name)
return ["complete at "+self.name]
else:
print("I'm %s, passing to %s" % (self.name,self.nextName))
message.append(self.name)
result=self.next.process(message)
result.insert(0,"passed on from "+self.name)
return result
|