chiark / gitweb /
cgi.py: Set the default static URL prefix from user's `SCRIPT_NAME'.
[chopwood] / cgi.py
diff --git a/cgi.py b/cgi.py
index 8009eafcd3f5abef6ee15a5c10abae9f602174a8..6ad9e756c37efd49d6dd8fcad92b3ee16ab7716f 100644 (file)
--- a/cgi.py
+++ b/cgi.py
@@ -51,7 +51,11 @@ CONF.DEFAULTS.update(
 
   ## A (maybe relative) URL for static content.  By default this comes from
   ## the main script, but we hope that user agents cache it.
-  STATIC = _script_name + '/static')
+  STATIC = None)
+
+@CONF.hook
+def set_static():
+  if CFG.STATIC is None: CFG.STATIC = CFG.SCRIPT_NAME + '/static'
 
 ###--------------------------------------------------------------------------
 ### Escaping and encoding.