summaryrefslogtreecommitdiff
path: root/examples/todo_sql/web/__init__.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-04-22 02:44:48 +0000
committerianb <devnull@localhost>2005-04-22 02:44:48 +0000
commit4431828c677e6104b7abc62b31a933d2793ff6cf (patch)
tree887f7b87f167a988566657304331ba8bb15ed4d6 /examples/todo_sql/web/__init__.py
downloadpaste-4431828c677e6104b7abc62b31a933d2793ff6cf.tar.gz
Renamed WSGIKit to Paste
Diffstat (limited to 'examples/todo_sql/web/__init__.py')
-rw-r--r--examples/todo_sql/web/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/todo_sql/web/__init__.py b/examples/todo_sql/web/__init__.py
new file mode 100644
index 0000000..835887d
--- /dev/null
+++ b/examples/todo_sql/web/__init__.py
@@ -0,0 +1,17 @@
+import os
+from wsgikit import wsgilib
+from wsgikit.util.thirdparty import add_package
+add_package('sqlobject')
+import sqlobject
+
+sql_set = False
+
+def urlparser_hook(environ):
+ global sql_set
+ if not environ.has_key('todo_sql.base_url'):
+ environ['todo_sql.base_url'] = environ['SCRIPT_NAME']
+ if not sql_set:
+ sql_set = True
+ db_uri = environ['wsgikit.config']['database']
+ sqlobject.sqlhub.processConnection = sqlobject.connectionForURI(
+ db_uri)