From: Mark Wooding Date: Mon, 22 Dec 2014 20:32:58 +0000 (+0000) Subject: cgi.py: Set the default static URL prefix from user's `SCRIPT_NAME'. X-Git-Tag: 1.2.0~15 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/commitdiff_plain/2ec2b38ffe12eb14c57dc0053cdf70a93736a283?hp=0c58273e69f08d17e69d9af6b04734bdce302532 cgi.py: Set the default static URL prefix from user's `SCRIPT_NAME'. Otherwise you have to set them both, and that's just annoying. --- diff --git a/cgi.py b/cgi.py index 8009eaf..6ad9e75 100644 --- 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.