summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/wsgi/composite.py
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-17 22:44:52 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-17 22:44:52 +0000
commitc59c7ef6db1f5c6458109f0627a8853c7f162f80 (patch)
treeb2f9af2724b28f09746e9143ad12496206f8f838 /sca-cpp/trunk/modules/wsgi/composite.py
parentc8dd567ff6ea5b0fa2296b3819fb138e8ccc2b93 (diff)
Support the host property and a /logout URL on WSGI servers.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@965145 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rwxr-xr-xsca-cpp/trunk/modules/wsgi/composite.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/wsgi/composite.py b/sca-cpp/trunk/modules/wsgi/composite.py
index 4be44c3101..453718e556 100755
--- a/sca-cpp/trunk/modules/wsgi/composite.py
+++ b/sca-cpp/trunk/modules/wsgi/composite.py
@@ -86,6 +86,9 @@ def result(e, r, st, h = (), b = None):
r("200 OK", list(h + (("Etag", md), ("Expires", "Tue, 01 Jan 1980 00:00:00 GMT"))))
return b
+ if st == 301:
+ r("301 Moved Permanently", list(h))
+
return failure(e, r, 500)
# Return an HTTP failure result
@@ -115,6 +118,14 @@ def postArgs(a):
l = car(a);
return cons(l, postArgs(cdr(a)))
+# Return the URL of the logout page
+def logout(ruri):
+ try:
+ from google.appengine.api import users
+ return users.create_logout_url(ruri)
+ except:
+ return None
+
# WSGI application function
def application(e, r):
m = requestMethod(e)
@@ -132,6 +143,14 @@ def application(e, r):
return fileresult(e, r, "application/x-javascript", fpath)
if fpath.endswith(".png"):
return fileresult(e, r, "image/png", fpath)
+ if fpath == "/":
+ return result(e, r, 301, (("Location", "/index.html"),))
+
+ # Logout
+ if fpath == "/logout":
+ redir = logout("/")
+ if redir:
+ return result(e, r, 301, (("Location", redir),))
# Find the requested component
path = tokens(fpath)