Properly separate the auth.fcgi and unauth.fcgi scripts cherrypy-rebased
authorQuentin Smith <quentin@mit.edu>
Mon, 21 Dec 2009 05:05:15 +0000 (00:05 -0500)
committerQuentin Smith <quentin@mit.edu>
Mon, 21 Dec 2009 05:05:15 +0000 (00:05 -0500)
svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2739

code/auth.fcgi [changed from symlink to file mode: 0755]
code/invirt.fcgi
code/main.conf
code/unauth.fcgi [changed from symlink to file mode: 0755]
debian/changelog

deleted file mode 120000 (symlink)
index b94e858171d9e3326629a2bec6da2c37ad138c76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-invirt.fcgi
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..96a8bcf5485f4c24a5899ec38278c0d33b9d79c8
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./invirt.fcgi auth "$@"
index c01eb7f..0bce132 100755 (executable)
@@ -11,26 +11,30 @@ dev = False
 base_dir = os.path.dirname(__file__)
 
 def usage():
-    print >>sys.stderr, """%s [config]
+    argv0_dir = os.path.dirname(sys.argv[0])
+    print >>sys.stderr, """%s <unauth|auth> [config]
+%s/auth.fcgi [config]
+%s/unauth.fcgi [config]
 
 Run server as FastCGI, with CherryPy config from "main.conf".
 
 With `config`, run standalone with CherryPy config from `config`.
 
 Run this script as either 'auth.fcgi' or 'unauth.fcgi', to get
-the authenticated or unauthenticated site respectively.
-""" % sys.argv[0]
+the authenticated or unauthenticated site respectively, or pass
+'auth' or 'unauth' as the first parameter.
+""" % (sys.argv[0], argv0_dir, argv0_dir)
     sys.exit(2)
 
 if __name__ == "__main__":
-    if len(sys.argv) > 2:
+    if len(sys.argv) > 3 or len(sys.argv) == 1 or '-h' in sys.argv or '--help' in sys.argv:
         usage()
-    if len(sys.argv) > 1:
-        if sys.argv[1] in ('-h', '--help'):
-            usage()
-        conf_file = sys.argv[1]
+    if len(sys.argv) == 3:
+        mode = sys.argv[1]
+        conf_file = sys.argv[2]
         dev = True
     else:
+        mode = sys.argv[1]
         conf_file = os.path.join(base_dir, 'main.conf')
 
     app_config = {
@@ -39,10 +43,12 @@ if __name__ == "__main__":
             },
         }
 
-    if os.path.basename(sys.argv[0]).startswith('auth'):
+    if mode.startswith('auth'):
         root = main.InvirtWeb()
-    elif os.path.basename(sys.argv[0]).startswith('unauth'):
+        app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-auth-web-templatecache"
+    elif mode.startswith('unauth'):
         root = main.InvirtUnauthWeb()
+        app_config['/']['tools.mako.module_directory'] = "/tmp/invirt-unauth-web-templatecache"
     else:
         usage()
 
index 6381f19..85cad69 100644 (file)
@@ -2,7 +2,6 @@
 [global]
 #auto_reload doesn't work with FastCGI
 engine.auto_reload = False
-tools.mako.module_directory = "/tmp/invirt-web-templatecache"
 tools.remote_user_login.on = True
 
 engine.SIGHUP = None
deleted file mode 120000 (symlink)
index b94e858171d9e3326629a2bec6da2c37ad138c76..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-invirt.fcgi
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..75bac9c91e3e64f879c1c6acee6ba9278c91cd07
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./invirt.fcgi unauth "$@"
index b37745c..52317d2 100644 (file)
@@ -1,3 +1,11 @@
+invirt-web (0.1.1) unstable; urgency=low
+
+  * Use a different Mako template cache for auth.fcgi and unauth.fcgi
+  * Use shell scripts for the auth.fcgi and unauth.fcgi so that Apache
+    will not think they are the same script.
+
+ -- Quentin Smith <quentin@mit.edu>  Sun, 20 Dec 2009 23:53:17 -0500
+
 invirt-web (0.1.0) unstable; urgency=low
 
   [Quentin Smith]