summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paste/errordocument.py4
-rw-r--r--paste/modpython.py8
-rw-r--r--paste/recursive.py16
-rw-r--r--paste/registry.py12
-rw-r--r--paste/reloader.py4
-rw-r--r--paste/response.py4
-rw-r--r--paste/session.py4
-rw-r--r--paste/wsgilib.py12
8 files changed, 47 insertions, 17 deletions
diff --git a/paste/errordocument.py b/paste/errordocument.py
index 16b091c..731449f 100644
--- a/paste/errordocument.py
+++ b/paste/errordocument.py
@@ -108,7 +108,9 @@ class StatusBasedForward:
Here is an example where a ``404 File Not Found`` status response would be
redirected to the URL ``/error?code=404&message=File%20Not%20Found``. This
could be useful for passing the status code and message into another
- application to display an error document::
+ application to display an error document:
+
+ .. code-block:: Python
from paste.errordocument import StatusBasedForward
from paste.recursive import RecursiveMiddleware
diff --git a/paste/modpython.py b/paste/modpython.py
index 98bf6f7..1a8bc5c 100644
--- a/paste/modpython.py
+++ b/paste/modpython.py
@@ -1,5 +1,4 @@
-"""
-WSGI Paste wrapper for mod_python. Requires Python 2.2 or greater.
+"""WSGI Paste wrapper for mod_python. Requires Python 2.2 or greater.
Example httpd.conf section for a Paste app with an ini file::
@@ -53,7 +52,10 @@ http://projects.amor.org/misc/svn/modpython_gateway.py
import traceback
import os
-from mod_python import apache
+try:
+ from mod_python import apache
+except:
+ pass
from paste.deploy import loadapp
class InputWrapper(object):
diff --git a/paste/recursive.py b/paste/recursive.py
index 50ab942..37e41ae 100644
--- a/paste/recursive.py
+++ b/paste/recursive.py
@@ -101,7 +101,9 @@ class ForwardRequestException(Exception):
as the first argument and returns an initialised WSGI middleware
which can alter the forwarded response.
- Basic usage (must have ``RecursiveMiddleware`` present) ::
+ Basic usage (must have ``RecursiveMiddleware`` present) :
+
+ .. code-block:: Python
from paste.recursive import ForwardRequestException
def app(environ, start_response):
@@ -125,7 +127,9 @@ class ForwardRequestException(Exception):
a ``404 Not found`` status message.
You could also specify an ``environ`` dictionary instead of a url. Using
- the same example as before::
+ the same example as before:
+
+ .. code-block:: Python
def app(environ, start_response):
... same as previous example ...
@@ -137,7 +141,9 @@ class ForwardRequestException(Exception):
Finally, if you want complete control over every aspect of the forward you
can specify a middleware factory. For example to keep the old status code
but use the headers and resposne body from the forwarded response you might
- do this::
+ do this:
+
+ .. code-block:: Python
from paste.recursive import ForwardRequestException
from paste.recursive import RecursiveMiddleware
@@ -266,7 +272,9 @@ class Forwarder(Recursive):
It must not be called after and headers have been returned.
It returns an iterator that must be returned back up the call
- stack, so it must be used like::
+ stack, so it must be used like:
+
+ .. code-block:: Python
return environ['paste.recursive.forward'](path)
diff --git a/paste/registry.py b/paste/registry.py
index a34dbde..283fd39 100644
--- a/paste/registry.py
+++ b/paste/registry.py
@@ -22,7 +22,9 @@ actually "be" during the request is then registered with the
RegistryManager middleware, which ensures that for the scope of the current
WSGI application everything will work properly.
-Example::
+Example:
+
+.. code-block:: Python
#yourpackage/__init__.py
@@ -60,7 +62,9 @@ when developing web applications.
Should you be developing a system which may be accessing the proxy object
thousands of times per request, the performance of the proxy will start to
become more noticeabe. In that circumstance, the problem can be avoided by
-getting at the actual object via the proxy with the ``_curent_obj`` function::
+getting at the actual object via the proxy with the ``_curent_obj`` function:
+
+.. code-block:: Python
#sessions.py
Session = StackedObjectProxy()
@@ -190,7 +194,9 @@ class StackedObjectProxy(object):
def _push_object(self, obj):
"""Make ``obj`` the active object for this thread-local.
- This should be used like::
+ This should be used like:
+
+ .. code-block:: Python
obj = yourobject()
module.glob = StackedObjectProxy()
diff --git a/paste/reloader.py b/paste/reloader.py
index 96614af..607d772 100644
--- a/paste/reloader.py
+++ b/paste/reloader.py
@@ -3,7 +3,9 @@
"""
A file monitor and server restarter.
-Use this like::
+Use this like:
+
+..code-block:: Python
import reloader
reloader.install()
diff --git a/paste/response.py b/paste/response.py
index d5cea3c..7b7d6a1 100644
--- a/paste/response.py
+++ b/paste/response.py
@@ -189,7 +189,9 @@ def error_response(environ, error_code, message,
"""
Returns the status, headers, and body of an error response.
- Use like::
+ Use like:
+
+ ..code-block:: Python
status, headers, body = wsgilib.error_response(
'301 Moved Permanently', 'Moved to <a href="%s">%s</a>'
diff --git a/paste/session.py b/paste/session.py
index c2feac6..6cddf5d 100644
--- a/paste/session.py
+++ b/paste/session.py
@@ -4,7 +4,9 @@
"""
Creates a session object in your WSGI environment.
-Use like::
+Use like:
+
+..code-block:: Python
environ['paste.session.factory']()
diff --git a/paste/wsgilib.py b/paste/wsgilib.py
index 5223631..b2e8c68 100644
--- a/paste/wsgilib.py
+++ b/paste/wsgilib.py
@@ -414,7 +414,9 @@ def capture_output(environ, start_response, application):
status, headers, and body.
Sends status and header, but *not* body. Returns (status,
- headers, body). Typically this is used like::
+ headers, body). Typically this is used like:
+
+ ..code-block:: Python
def dehtmlifying_middleware(application):
def replacement_app(environ, start_response):
@@ -462,7 +464,9 @@ def intercept_output(environ, application, conditional=None,
body. None are sent on; you must send them on yourself (unlike
``capture_output``)
- Typically this is used like::
+ Typically this is used like:
+
+ ..code-block:: Python
def dehtmlifying_middleware(application):
def replacement_app(environ, start_response):
@@ -481,7 +485,9 @@ def intercept_output(environ, application, conditional=None,
the request should not be intercepted. In that case
``start_response`` will be called and ``(None, None, app_iter)``
will be returned. You must detect that in your code and return
- the app_iter, like::
+ the app_iter, like:
+
+ ..code-block:: Python
def dehtmlifying_middleware(application):
def replacement_app(environ, start_response):