7.11 Request Classes
The choice of Request class determines how you wish to deploy
your application. Albatross supplies a number of pre-built Request
implementations suited to various deployment methods. These include:
CGI |
albatross.cgiapp |
mod_python |
albatross.apacheapp |
FastCGI_python |
albatross.fcgiapp |
Stand-alone Python HTTP server |
albatross.httpdapp |
You can also develop your own Request class to deploy an
Albatross application in other ways.
All Request classes implement the same interface. Much of this
interface can be supplied by the RequestBase mixin.
-
-
Returns
TRUE
if the field identified by the name argument
is present in the request.
-
-
Return the value of the field identified by the name argument.
-
-
Returns an object that contains the value of a file input field.
-
-
Return a list of all all fields names in the request.
-
-
Return the URL which the browser used to perform the request.
-
-
Return the name of the server (Apache ServerName setting).
-
-
Return the value of the HTTP header identified in the name
argument.
-
-
Add a header named name with the value value to the
response. This method should not be called once you have started sending
content to the browser.
-
-
Signal to the Request object that header generation has finished and
that you are ready to start sending content.
-
-
Send a "301 Moved Permanently" response back to the browser.
-
-
Send data as part of the request response.
-
-
Sets the HTTP status code of the response. Defaults to 200. For
deployment methods based on the cgiapp module, this value is used to
derive the Status: header. The apacheapp module uses it to set
the status member of the mod_python request object.
-
-
Return the saved value for the HTTP status code.
-
-
Returns a value which should be returned from the Application
class run() method. For most deployment methods, this
is None, however the mod_python requires that
mod_python.apache.OK be returned if application emits any
content. Your mod_python application should include code such
as this:
from albatross.apacheapp import Request
:
:
def handler(req):
return app.run(Request(req))