Package twisted :: Package cred :: Module perspective :: Class Perspective

[frames | no frames]

## Class Perspective

Known Subclasses:
  `MemoryAccount`, `Perspective`

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.
| `isCached(self)`
| ``makeIdentity`(self, password)` Make an identity from this perspective with a password.
| `setCached(self)`
| ``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
`tuple` | `__implements__` = `(<class twisted.cred.perspective.IPersp...`
`int` | `_attachedCount` = 0
`int` | `_service_cached` = 0

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

### __implements__

  Type:
    `tuple`
  Value:

        (<class twisted.cred.perspective.IPerspective at 0x85727dc>,)

### _attachedCount

  Type:
    `int`
  Value:

        0

### _service_cached

  Type:
    `int`
  Value:

        0

Generated by Epydoc 2.0 on Sat May 15 20:08:26 2004 | http://epydoc.sf.net