[Twisted-Python] PATCH: /doc/examples/pbecho.py

Lee Harr missive at hotmail.com
Sat Jan 18 03:57:43 EST 2003


I was getting some deprecation errors running this one, so I
remodeled it to look like /doc/howto/listings/pb/pb6server.py


3:24 >cvs diff -u pbecho.py
Index: pbecho.py
===================================================================
RCS file: /cvs/Twisted/doc/examples/pbecho.py,v
retrieving revision 1.7
diff -u -r1.7 pbecho.py
--- pbecho.py   25 May 2002 06:02:31 -0000      1.7
+++ pbecho.py   18 Jan 2003 08:20:44 -0000
@@ -17,6 +17,7 @@

from twisted.spread import pb
from twisted.internet import app
+from twisted.cred.authorizer import DefaultAuthorizer

class DefinedError(pb.Error):
     pass
@@ -35,6 +36,12 @@
if __name__ == '__main__':
     import pbecho
     appl = app.Application("pbecho")
-    
pbecho.SimpleService("pbecho",appl).getPerspectiveNamed("guest").makeIdentity("guest")
-    appl.listenTCP(pb.portno, pb.BrokerFactory(pb.AuthRoot(appl)))
+    auth = DefaultAuthorizer(appl)
+    s = pbecho.SimpleService("pbecho", appl, auth)
+    s.createPerspective("guest")
+    i1 = auth.createIdentity("guest")
+    i1.setPassword("guest")
+    i1.addKeyByString("pbecho", "guest")
+    auth.addIdentity(i1)
+    appl.listenTCP(pb.portno, pb.BrokerFactory(pb.AuthRoot(auth)))
     appl.save("start")






_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus





More information about the Twisted-Python mailing list