[Twisted-Python] Perspective / Client confusion

Patrick K. O'Brien pobrien at orbtech.com
Thu May 29 10:31:47 EDT 2003

I've read all the spread and pb docs several times now, and I'm still confused 
about some issues, particularly having to do with cred.  I've created a pb 
app and am trying to figure out the best way to use Perspectives.  Can 
someone explain why I would want to use one Perspective instance that kept 
track of attached clients, as shown in listings/pclients/multiple.py, versus 
creating a Perspective instance for each client, versus something more 
dynamic as hinted at in http://www.twistedmatrix.com/documents/howto/pb-cred:

In addition, .attached() has the opportunity to return a different 
Perspective, if it so chooses. You could have all users initially access the 
same Perspective, but then as they connect (and .attached() gets called), 
give them unique Perspectives based upon their individual Identities. The 
client will get a reference to whatever .attached() returns, so the default 
case is to 'return self'.

This application is sort of like a traditional database application.  There 
will be admin-type users as well as employees with more limited authority.  
Customers will also have access to the application but will only be able to 
make changes to their own account information.  I have a very simple demo 
that I am using to try out different approaches, which you can find here, if 
you want to see how I'm coding things:


Since I'm using PyPerSyst to persist all the application data, I could also 
store user information there and use that to determine what a user can/cannot 
do, rather than rely on Perspectives.  But I'm not sure that is the right 
approach.  Any help would be greatly appreciated.

Patrick K. O'Brien
Orbtech      http://www.orbtech.com/web/pobrien
"Your source for Python programming expertise."

More information about the Twisted-Python mailing list