diff options
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/modules/wsgi/scdl.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sca-cpp/trunk/modules/wsgi/scdl.py b/sca-cpp/trunk/modules/wsgi/scdl.py index a50bba3b7a..309f7f91f8 100644 --- a/sca-cpp/trunk/modules/wsgi/scdl.py +++ b/sca-cpp/trunk/modules/wsgi/scdl.py @@ -19,6 +19,7 @@ from xml.etree.cElementTree import iterparse from sys import stderr +from os import environ from util import * from httputil import * @@ -186,9 +187,11 @@ def evalReference(r, comps): return nameToComponent(t, comps) # Evaluate a property, return a lambda function returning the property -# value. The user and email properties are configured with the values -# from the HTTP request, if any +# value. The host, user and email properties are configured with the +# values from the HTTP request, if any def evalProperty(p): + if car(p) == "host": + return lambda: hostProperty(cadr(p), environ) if car(p) == "user": return lambda: userProperty(cadr(p)) if car(p) == "email": @@ -206,6 +209,9 @@ def userProperty(v): user = currentUser() return user.user_id() if user else v +def hostProperty(v, e): + return e.get("HTTP_HOST", e.get("SERVER_NAME", v)).split(":")[0] + def emailProperty(v): user = currentUser() return user.email() if user else v |