WebKit.ServletFactory | index /usr/local/share/webware/WebKit/ServletFactory.py

`Servlet factory template.`

Modules

``

os | sys | threading |

Classes

``

__builtin__.object
  ServletFactory
    PythonServletFactory

class PythonServletFactory(ServletFactory)
`` | `The factory for Python servlets. This is the factory for ordinary Python servlets whose extensions are empty or .py. The servlets are unique per file since the file itself defines the servlet.`

Method resolution order:
  PythonServletFactory
  ServletFactory
  __builtin__.object

Methods defined here:

extensions(self)

loadClass(self, transaction, path)

uniqueness(self)

Methods inherited from ServletFactory:

__init__(self, application)
  `Create servlet factory.
  Stores a reference to the application in self._app, because
  subclasses may or may not need to talk back to the application
  to do their work.`

flushCache(self)
  `Flush the servlet cache and start fresh.
  Servlets that are currently in the wild may find their way back
  into the cache (this may be a problem).`

importAsPackage(self, transaction, serverSidePathToImport)
  `Import requested module.
  Imports the module at the given path in the proper package/subpackage
  for the current request. For example, if the transaction has the URL
  http://localhost/WebKit.cgi/MyContextDirectory/MySubdirectory/MyPage
  and path = 'some/random/path/MyModule.py' and the context is configured
  to have the name 'MyContext' then this function imports the module at
  that path as MyContext.MySubdirectory.MyModule . Note that the context
  name may differ from the name of the directory containing the context,
  even though they are usually the same by convention.
  Note that the module imported may have a different name from the
  servlet name specified in the URL. This is used in PSP.`

name(self)
  `Return the name of the factory.
  This is a convenience for the class name.`

returnServlet(self, servlet)
  `Return servlet to the pool.
  Called by Servlet.close(), which returns the servlet
  to the servlet pool if necessary.`

servletForTransaction(self, transaction)
  `Return a new servlet that will handle the transaction.
  This method handles caching, and will call loadClass(trans, filepath)
  if no cache is found. Caching is generally controlled by servlets
  with the canBeReused() and canBeThreaded() methods.`

Data descriptors inherited from ServletFactory:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class ServletFactory(__builtin__.object)

``

`Servlet factory template.
ServletFactory is an abstract class that defines the protocol for
all servlet factories.
Servlet factories are used by the Application to create servlets
for transactions.
A factory must inherit from this class and override uniqueness(),
extensions() and either loadClass() or servletForTransaction().
Do not invoke the base class methods as they all raise AbstractErrors.
Each method is documented below.
`

Methods defined here:

__init__(self, application)
  `Create servlet factory.
  Stores a reference to the application in self._app, because
  subclasses may or may not need to talk back to the application
  to do their work.`

extensions(self)
  `Return a list of extensions that match this handler.
  Extensions should include the dot. An empty string indicates a file
  with no extension and is a valid value. The extension '.*' is a special
  case that is looked for a URL's extension doesn't match anything.`

flushCache(self)
  `Flush the servlet cache and start fresh.
  Servlets that are currently in the wild may find their way back
  into the cache (this may be a problem).`

importAsPackage(self, transaction, serverSidePathToImport)
  `Import requested module.
  Imports the module at the given path in the proper package/subpackage
  for the current request. For example, if the transaction has the URL
  http://localhost/WebKit.cgi/MyContextDirectory/MySubdirectory/MyPage
  and path = 'some/random/path/MyModule.py' and the context is configured
  to have the name 'MyContext' then this function imports the module at
  that path as MyContext.MySubdirectory.MyModule . Note that the context
  name may differ from the name of the directory containing the context,
  even though they are usually the same by convention.
  Note that the module imported may have a different name from the
  servlet name specified in the URL. This is used in PSP.`

loadClass(self, transaction, path)
  `Load the appropriate class.
  Given a transaction and a path, load the class for creating these
  servlets. Caching, pooling, and threadsafeness are all handled by
  servletForTransaction. This method is not expected to be threadsafe.`

name(self)
  `Return the name of the factory.
  This is a convenience for the class name.`

returnServlet(self, servlet)
  `Return servlet to the pool.
  Called by Servlet.close(), which returns the servlet
  to the servlet pool if necessary.`

servletForTransaction(self, transaction)
  `Return a new servlet that will handle the transaction.
  This method handles caching, and will call loadClass(trans, filepath)
  if no cache is found. Caching is generally controlled by servlets
  with the canBeReused() and canBeThreaded() methods.`

uniqueness(self)
  `Return uniqueness type.
  Returns a string to indicate the uniqueness of the ServletFactory's
  servlets. The Application needs to know if the servlets are unique
  per file, per extension or per application.
  Return values are 'file', 'extension' and 'application'.
  NOTE: Application only supports 'file' uniqueness at this point in time.`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Functions

``

iskeyword = __contains__(...)
  `x.__contains__(y) <==> y in x.`

Data
`` |  | debug = False