Table of Contents

Class: Service | Twisted-0.17.4/twisted/cred/service.py
--- | ---

### I am a service that internet applications interact with.

I represent a set of abstractions which users may interact with over a specified protocol.

(See Also: twisted.spread.pb.Service)

Methods |
--- | ---

__init__ addPerspective cachePerspective createPerspective getPerspectiveNamed getPerspectiveRequest getServiceName | getServiceType loadPerspective setApplication startService stopService uncachePerspective

| __init__

    __init__ (
            self,
            serviceName,
            application=None,
            )

### Create me, attached to the given application.

Arguments: application, a twisted.internet.app.Application instance.

Exceptions |
--- | ---
TypeError( "%s is not a string." % serviceName )

| addPerspective

    addPerspective ( self,  perspective )

Add a perspective to this Service.

Exceptions |
--- | ---
TypeError

| cachePerspective

    cachePerspective ( self,  perspective )

### Cache a perspective loaded from an external data source.

Perspectives that were `loaded` from memory will not be uncached.

| createPerspective

    createPerspective ( self,  name )

Create a perspective from self.perspectiveClass and add it to this service.

| getPerspectiveNamed

    getPerspectiveNamed ( self,  name )

### Return a perspective that represents a user for this service. (DEPRECATED)

Raises a KeyError if no such user exists. Override this method to provide dynamic instantiation of perspectives -- it is deprecated to call this method directly.

| getPerspectiveRequest

    getPerspectiveRequest ( self,  name )

Return a Deferred which is a request for a perspective on this service.

| getServiceName

    getServiceName ( self )

The name of this service.

| getServiceType

    getServiceType ( self )

Get a string describing the type of this service.

| loadPerspective

    loadPerspective ( self,  name )

### Load a perspective from an external data-source.

If no such data-source exists, return None. Implement this if you want to load your perspectives from somewhere else (e.g. LDAP or a database). It is not recommended to call this directly, since getPerspectiveRequest provides management of caching perspectives.

| setApplication

    setApplication ( self,  application )

Exceptions |
--- | ---
RuntimeError( "Application already set!" ) TypeError( "%s is not an Application" % application )

| startService

    startService ( self )

This call is made as a service starts up.

| stopService

    stopService ( self )

This call is made before shutdown.

| uncachePerspective

    uncachePerspective ( self,  perspective )

### Uncache a perspective loaded from an external data source.

Perspectives that were `loaded` from memory will not be uncached.

Table of Contents

This document was automatically generated on Sat Apr 20 01:32:12 2002 by HappyDoc version 2.0