summaryrefslogtreecommitdiff
path: root/routes/__init__.py
diff options
context:
space:
mode:
authorbbangert <none@none>2005-11-16 16:21:49 -0800
committerbbangert <none@none>2005-11-16 16:21:49 -0800
commit186f03435bae9cc5a3a269d4d81cde0eab13064d (patch)
tree5032ef269b7090e4793d5ddf42f4fcbf38417755 /routes/__init__.py
parent4754b312a7b4c275d58ec0e414e67bb7ea273976 (diff)
downloadroutes-186f03435bae9cc5a3a269d4d81cde0eab13064d.tar.gz
[svn] More doc updates
--HG-- branch : trunk
Diffstat (limited to 'routes/__init__.py')
-rw-r--r--routes/__init__.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/routes/__init__.py b/routes/__init__.py
index 8f63987..8796ca1 100644
--- a/routes/__init__.py
+++ b/routes/__init__.py
@@ -23,6 +23,38 @@ else:
return self.__shared_state.__setattr__(name, value)
def request_config():
+ """
+ Returns the Routes RequestConfig object.
+
+ This object is a thread-local singleton that should be initialized by
+ the web framework that is utilizing Routes.
+
+ To get the Routes RequestConfig:
+
+ >>> from routes import *
+ >>> config = routes.request_config()
+
+ The following attributes must be set on the config object every request:
+
+ mapper
+ mapper should be a Mapper instance thats ready for use
+ host
+ host is the hostname of the webapp
+ protocol
+ protocol is the protocol of the current request
+ mapper_dict
+ mapper_dict should be the dict returned by mapper.match()
+ redirect
+ redirect should be a function that issues a redirect,
+ and takes a url as the sole argument
+ prefix (optional)
+ Set if the application is moved under a URL prefix. Prefix
+ will be stripped before matching, and prepended on generation
+ environ (optional)
+ Set to the WSGI environ for automatic prefix support if the
+ webapp is underneath a 'SCRIPT_NAME'
+
+ """
return _RequestConfig()
from base import Mapper