aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces/web/cfbe.py
diff options
context:
space:
mode:
authorChris Ball <cjb@t60>2010-06-20 19:25:59 -0400
committerChris Ball <cjb@t60>2010-06-20 19:25:59 -0400
commit3ded6cc157a4145370cef50e7d15b8a07441042e (patch)
tree04a1dc277c65cf1396487fe14eddd98a2b4e1047 /interfaces/web/cfbe.py
parent0df4bd7ae194bb07f36a2a69a0549037de01cb52 (diff)
parent2a8eb1f87a2c3f92d9113419ff125afb98b2e4ed (diff)
downloadbugseverywhere-3ded6cc157a4145370cef50e7d15b8a07441042e.tar.gz
Merge Steve Losh's cfbe tree, from:
http://bitbucket.org/sjl/cherryflavoredbugseverywhere/
Diffstat (limited to 'interfaces/web/cfbe.py')
-rwxr-xr-xinterfaces/web/cfbe.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/interfaces/web/cfbe.py b/interfaces/web/cfbe.py
new file mode 100755
index 0000000..63fbc7e
--- /dev/null
+++ b/interfaces/web/cfbe.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import cherrypy
+from cherryflavoredbugseverywhere import web
+from optparse import OptionParser
+from os import path
+
+module_dir = path.dirname(path.abspath(web.__file__))
+template_dir = path.join(module_dir, 'templates')
+
+def build_parser():
+ """Builds and returns the command line option parser."""
+
+ usage = 'usage: %prog bug_directory'
+ parser = OptionParser(usage)
+ return parser
+
+def parse_arguments():
+ """Parse the command line arguments."""
+
+ parser = build_parser()
+ (options, args) = parser.parse_args()
+
+ if len(args) != 1:
+ parser.error('You need to specify a bug directory.')
+
+ return { 'bug_root': args[0], }
+
+
+config = path.join(module_dir, 'cfbe.config')
+options = parse_arguments()
+
+WebInterface = web.WebInterface(path.abspath(options['bug_root']), template_dir)
+
+cherrypy.config.update({'tools.staticdir.root': path.join(module_dir, 'static')})
+app_config = { '/static': { 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '', } }
+cherrypy.quickstart(WebInterface, '/', app_config)