Package twisted :: Package cred :: Module perspective :: Class Perspective
[show private | hide private]
[frames | no frames]

Class Perspective

Known Subclasses:
Perspective, PerspectiveForIdentityTest

I am an Identity's view onto a service.

I am the interface through which most 'external' code should interact with a service; I represent the actions a user may perform upon a service, and the state associated with that user for that service.
Method Summary
  __init__(self, perspectiveName, identityName)
Create me.
  attached(self, reference, identity)
Called when a remote reference is 'attached' to me.
  detached(self, reference, identity)
Called when a broker is 'detached' from me.
  getIdentityRequest(self)
Request my identity.
  getPerspectiveName(self)
Return the unique name of this perspective.
  getService(self)
Return a service.
  makeIdentity(self, password)
Make an identity from this perspective with a password.
  setIdentity(self, ident)
Determine which identity I connect to.
  setIdentityName(self, name)
  setService(self, service)
Change what service I am a part of.

Class Variable Summary
int _attachedCount
int _service_cached

Method Details

__init__(self, perspectiveName, identityName='Nobody')
(Constructor)

Create me.

I require a name for myself and a reference to the service I participate in. (My identity name will be 'Nobody' by default, which will normally not resolve.)

attached(self, reference, identity)

Called when a remote reference is 'attached' to me.

After being authorized, a remote actor can attach to me through its identity. This call will be made when that happens, and the return value of this method will be used as the _actual_ perspective to which I am attached.

Note that the symmetric call, detached, will be made on whatever this method returns, _not_ on me. Therefore, by default I return 'self'.

detached(self, reference, identity)

Called when a broker is 'detached' from me.

See 'attached'.

When a remote actor disconnects (or times out, for example, with HTTP), this is called in order to indicate that the reference associated with that peer is no longer attached to this perspective.

getIdentityRequest(self)

Request my identity.

getPerspectiveName(self)

Return the unique name of this perspective.

This will return a value such that self.service.getPerspectiveNamed(value) is self.

(XXX: That's assuming I have been addPerspective'd to my service.)

getService(self)

Return a service.

makeIdentity(self, password)

Make an identity from this perspective with a password.

This is a utility method, which can be used in circumstances where the distinction between Perspective and Identity is weak, such as single-Service servers.

setIdentity(self, ident)

Determine which identity I connect to.

setService(self, service)

Change what service I am a part of.

Class Variable Details

_attachedCount

Type:
int
Value:
0                                                                      

_service_cached

Type:
int
Value:
0                                                                      

Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:28:06 2003 http://epydoc.sf.net