[z3-checkins] r42110 - z3/deliverance/DeliveranceVHoster/trunk/docs

ianb at codespeak.net ianb at codespeak.net
Tue Apr 17 01:23:12 CEST 2007


Author: ianb
Date: Tue Apr 17 01:23:12 2007
New Revision: 42110

Added:
   z3/deliverance/DeliveranceVHoster/trunk/docs/configuration.txt   (contents, props changed)
Modified:
   z3/deliverance/DeliveranceVHoster/trunk/docs/openplans_hooks.py
Log:
added config doc

Added: z3/deliverance/DeliveranceVHoster/trunk/docs/configuration.txt
==============================================================================
--- (empty file)
+++ z3/deliverance/DeliveranceVHoster/trunk/docs/configuration.txt	Tue Apr 17 01:23:12 2007
@@ -0,0 +1,61 @@
+Configuration of dvhoster
+=========================
+
+Configuration is in a `PasteDeploy <http://pythonpaste.org/deploy/>`_
+.ini file.  These are the supported parameters:
+
+``data_dir`` (no default):
+    Where all the data about hosts is kept.  This should exist and be
+    writable.  All the information goes in subdirectories, one
+    subdirectory for each host.
+
+``rewrite_links`` (default false):
+    If true, then pages will have their links rewritten.  You can use
+    this if the application doesn't understand what the original
+    request was, and so passed through bad links (e.g., pointing to
+    localhost).
+
+``clean_environ_headers_regex`` (no default):
+    Any keys in the WSGI environ that match this regular expression
+    will be removed.  A value might be ``^HTTP_X_REMOTE_USER`` to
+    match any ``X-Remote-User`` header (and remove it).
+
+``safe_header_ips`` (no default):
+    Any requests from these ip addresses (a list separated by
+    whitespace) will not have their headers cleaned.
+
+``logger``:
+    This is the logger that messages should go to about any
+    Deliverance internal errors.  You can also use a filename, and the
+    log message will be directed there, or ``-`` and the log messages
+    will go to stdout.
+
+
+Debugging
+---------
+
+DVHoster accepts a ``debug`` configuration key which turns on the
+EvalException middleware.  This **must not be deployed in production**
+as it opens up bit security hole.
+
+``debug_headers`` will print out incoming and outgoing headers.  If
+``debug_bodies`` is also on then outgoing bodies will also be
+printed.  This is noisy, so should only be on for testing.
+
+
+Hooks
+-----
+
+There are three parameters: ``init_domain``, ``find_remote_uri``, and
+``should_theme_uri``.  These are described in the document on `hooks
+<hooks.html>`_.
+
+
+Hook Configuration
+------------------
+
+Each hook gets a dictionary of configuration parameters.  You can add
+new variables that will be interpreted by your custom hooks.
+
+Examples are in ``docs/openplans_hooks.py``, where it uses variables
+like ``zope_uri`` and ``domain_regex``.

Modified: z3/deliverance/DeliveranceVHoster/trunk/docs/openplans_hooks.py
==============================================================================
--- z3/deliverance/DeliveranceVHoster/trunk/docs/openplans_hooks.py	(original)
+++ z3/deliverance/DeliveranceVHoster/trunk/docs/openplans_hooks.py	Tue Apr 17 01:23:12 2007
@@ -7,7 +7,8 @@
 
 import re
 from paste.deploy.converters import asbool
-from paste.request import path_info_pop
+from paste.request import path_info_pop, construct_url
+from paste import httpexceptions
 
 rule_data = """\
 <?xml version="1.0" encoding="UTF-8"?>
@@ -62,7 +63,12 @@
     task_tracker_uri = app_conf['task_tracker_uri']
     project = environ.get('HTTP_X_OPENPLANS_PROJECT')
     path_info = environ.get('PATH_INFO', '')
-    if path_info.startswith('/tasks'):
+    if path_info == '/tasks':
+        # Need to redirect
+        new_url = construct_url(environ, path_info='/tasks/')
+        raise httpexceptions.HTTPMovedPermanently(
+            headers=[('Location': new_url)])
+    if path_info.startswith('/tasks/'):
         environ['HTTP_X_OPENPLANS_APPLICATION'] = 'tasktracker'
         remote_uri = task_tracker_uri
         # Move /tasks to SCRIPT_NAME


More information about the z3-checkins mailing list