twisted.web.server.Site

Package twisted :: Package web :: Module server :: Class Site |
[frames | no frames]

## Class Site

      Factory --+
                |
    ServerFactory --+
                    |
          HTTPFactory --+
                        |
                       Site

Method Summary
| ``__init__`(self, resource, logPath, timeout)` Initialize.
| `__getstate__(self)`
| ``_mkuid`(self)` (internal) Generate an opaque, unique ID for a user's session.
| ``_openLogFile`(self, path)` Override in subclasses, e.g.
| ``buildProtocol`(self, addr)` Generate a channel attached to this site.
| ``getChildWithDefault`(self, pathEl, request)` Emulate a resource's getChild method.
| ``getResourceFor`(self, request)` Get a resource for a request.
| ``getSession`(self, uid)` Get a previously generated session, by its unique ID.
| ``makeSession`(self)` Generate a new Session instance, and store it for future reference.
| ``render`(self, request)` Redirect because a Site is always a directory.
Inherited from HTTPFactory
| ``log`(self, request)` Log a request's result to the logfile, by default in combined log format.
| ``startFactory`(self)` This will be called before I begin listening on a Port or Connector.
| ``stopFactory`(self)` This will be called before I stop listening on all Ports/Connectors.
Inherited from Factory
| ``doStart`(self)` Make sure startFactory is called.
| ``doStop`(self)` Make sure stopFactory is called.

Class Variable Summary
`int` | `counter` = 0
`int` | `displayTracebacks` = 1
`int` | `isLeaf` = 0
`class` | `requestFactory` = `twisted.web.server.Request`
Inherited from HTTPFactory
`NoneType` | `logPath` = None
`int` | `timeOut` = 43200
Inherited from Factory
`tuple` | `__implements__` = `(<class twisted.internet.interfaces.IPr...`
`str` | `noisy` = `'sure, why not'`
`int` | `numPorts` = 0
`NoneType` | `protocol` = None

Method Details

### __init__(self, resource, logPath=None, timeout=43200) (Constructor) Initialize. Overrides: `twisted.protocols.http.HTTPFactory.__init__`

### _mkuid(self) (internal) Generate an opaque, unique ID for a user's session.

### _openLogFile(self, path) Override in subclasses, e.g. to use twisted.python.logfile. Overrides: `twisted.protocols.http.HTTPFactory._openLogFile` (inherited documentation)

### buildProtocol(self, addr) Generate a channel attached to this site. Overrides: `twisted.protocols.http.HTTPFactory.buildProtocol`

### getChildWithDefault(self, pathEl, request) Emulate a resource's getChild method.

### getResourceFor(self, request) Get a resource for a request. This iterates through the resource heirarchy, calling getChildWithDefault on each resource it finds for a path element, stopping when it hits an element where isLeaf is true.

### getSession(self, uid) Get a previously generated session, by its unique ID. This raises a KeyError if the session is not found.

### makeSession(self) Generate a new Session instance, and store it for future reference.

### render(self, request) Redirect because a Site is always a directory.

Class Variable Details

    ### counter Type: `int` Value:
        0

    ### displayTracebacks Type: `int` Value:
        1

    ### isLeaf Type: `int` Value:
        0

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