-"""Global module that all modules developing with CherryPy should import."""
+"""CherryPy is a pythonic, object-oriented HTTP framework.
+CherryPy consists of not one, but four separate API layers.
+The APPLICATION LAYER is the simplest. CherryPy applications are written as
+a tree of classes and methods, where each branch in the tree corresponds to
+a branch in the URL path. Each method is a 'page handler', which receives
+GET and POST params as keyword arguments, and returns or yields the (HTML)
+body of the response. The special method name 'index' is used for paths
+that end in a slash, and the special method name 'default' is used to
+handle multiple paths via a single handler. This layer also includes:
+ * the 'exposed' attribute (and cherrypy.expose)
+ * cherrypy.quickstart()
+ * _cp_config attributes
+ * cherrypy.tools (including cherrypy.session)
+The ENVIRONMENT LAYER is used by developers at all levels. It provides
+information about the current request and response, plus the application
+and server environment, via a (default) set of top-level objects:
+ * cherrypy.HTTPError, NotFound, and HTTPRedirect
+The EXTENSION LAYER allows advanced users to construct and share their own
+plugins. It consists of:
+Finally, there is the CORE LAYER, which uses the core API's to construct
+the default components which are available at higher layers. You can think
+of the default components as the 'reference implementation' for CherryPy.
+Megaframeworks (and advanced users) may replace the default components
+with customized or extended components. The core API's are:
+These API's are described in the CherryPy specification:
__version__ = "3.0.1alpha"
# objects. In this way, we can easily dump those objects when we stop/start
# a new HTTP conversation, yet still refer to them as module-level globals
+ """An interface for registering request and response objects."""
+ def load(self, request, response):
+ self.response = response
+ """Remove all attributes of self."""
+serving = _serving = _Serving()
# This will produce very different results from the above
# if you're using vhosts or tools.proxy.
- host = server.socket_host
- # The empty string signifies INADDR_ANY.
- # Look up the host name, which should be
- # the safest thing to spit out in a URL.
- host = socket.gethostname()
- port = server.socket_port
- if server.ssl_certificate:
- base = "%s://%s" % (scheme, host)
path = (script_name or "") + path
newurl = base + path + qs