twisted :: web :: server :: Site :: Class Site
[hide private]

Class Site

  internet.protocol.Factory --+        
                              |        
internet.protocol.ServerFactory --+    
                                  |    
                   http.HTTPFactory --+
                                      |
                                     Site
Known Subclasses:

A web site: manage log, sessions, and resources.

Nested Classes [hide private]

Inherited from http.HTTPFactory: protocol

Instance Methods [hide private]
 
__getstate__(self)
 
__init__(self, resource, logPath=None, timeout=43200)
Initialize.
 
_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 http.HTTPFactory: log, startFactory, stopFactory

Inherited from http.HTTPFactory (private): _escape, _updateLogDateTime

Inherited from internet.protocol.Factory: __providedBy__, __provides__, doStart, doStop, logPrefix

Class Variables [hide private]
  isLeaf = 0

Inherited from http.HTTPFactory: logPath, timeOut

Inherited from internet.protocol.Factory: __implemented__, noisy, numPorts

Instance Variables [hide private]
  counter = 0
increment value used for generating unique sessions ID.
  displayTracebacks = True
if set, Twisted internal errors are displayed on rendered pages.
  requestFactory
factory creating requests objects.
  sessionCheckTime = 1800
Deprecated.
  sessionFactory
factory for sessions objects.

Inherited from http.HTTPFactory (private): _logDateTime, _logDateTimeCall

Method Details [hide private]

__init__(self, resource, logPath=None, timeout=43200)
(Constructor)

 

Initialize.

Overrides: http.HTTPFactory.__init__

_openLogFile(self, path)

 

Override in subclasses, e.g. to use twisted.python.logfile.

Overrides: http.HTTPFactory._openLogFile
(inherited documentation)

buildProtocol(self, addr)

 

Generate a channel attached to this site.

Parameters:
  • addr - an object implementing twisted.internet.interfaces.IAddress
Overrides: internet.protocol.Factory.buildProtocol

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.


Instance Variable Details [hide private]

displayTracebacks

if set, Twisted internal errors are displayed on rendered pages. Default to True.
Value:
True

requestFactory

factory creating requests objects. Default to Request.
Value:
twisted.web.server.Request

sessionCheckTime

Deprecated. See Session.sessionTimeout instead.
Value:
1800

sessionFactory

factory for sessions objects. Default to Session.
Value:
twisted.web.server.Session