From d29f2c497b61e39408cbad015a2f27307021cb75 Mon Sep 17 00:00:00 2001 From: Steve Losh Date: Sun, 1 Feb 2009 21:19:59 -0500 Subject: [PATCH] Starting packaging up. --- .../values | 2 +- .../values | 2 +- .../values | 2 +- .../values | 2 +- .../values | 2 +- cfbe.py | 34 ++++++++++++++++-- static/images/stripe.png | Bin 101 -> 0 bytes templates/base.html | 1 - 8 files changed, 36 insertions(+), 9 deletions(-) delete mode 100644 static/images/stripe.png diff --git a/.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values b/.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values index 93bc968..0626932 100644 --- a/.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values +++ b/.be/bugs/0be47243-c172-4de9-b71b-d5dea60f91d5/values @@ -36,7 +36,7 @@ summary=Fix the null creation date bug. See bug ee6 in the BE repo for an examp -target=alpha +target=beta diff --git a/.be/bugs/35b962a0-a64a-4b5c-82c5-ea740e8a6322/values b/.be/bugs/35b962a0-a64a-4b5c-82c5-ea740e8a6322/values index 2f9356f..134df9b 100644 --- a/.be/bugs/35b962a0-a64a-4b5c-82c5-ea740e8a6322/values +++ b/.be/bugs/35b962a0-a64a-4b5c-82c5-ea740e8a6322/values @@ -22,7 +22,7 @@ severity=minor -status=open +status=closed diff --git a/.be/bugs/615ad650-9fb9-4026-9779-58d42b4e528e/values b/.be/bugs/615ad650-9fb9-4026-9779-58d42b4e528e/values index d9d9aed..56ae9a1 100644 --- a/.be/bugs/615ad650-9fb9-4026-9779-58d42b4e528e/values +++ b/.be/bugs/615ad650-9fb9-4026-9779-58d42b4e528e/values @@ -36,7 +36,7 @@ summary=Figure out how to best fix the column widths. -target=alpha +target=beta diff --git a/.be/bugs/870d5dbe-6449-4ec4-ae6f-e84bebadbce0/values b/.be/bugs/870d5dbe-6449-4ec4-ae6f-e84bebadbce0/values index 2086515..e91a4cf 100644 --- a/.be/bugs/870d5dbe-6449-4ec4-ae6f-e84bebadbce0/values +++ b/.be/bugs/870d5dbe-6449-4ec4-ae6f-e84bebadbce0/values @@ -22,7 +22,7 @@ severity=minor -status=open +status=closed diff --git a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/values b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/values index d0cefdf..964922f 100644 --- a/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/values +++ b/.be/bugs/e645d562-6f84-4df2-b8ee-86ef42546c16/values @@ -29,7 +29,7 @@ status=open -summary=Factor everything into a package. +summary=Package everything into something easy to download and use. diff --git a/cfbe.py b/cfbe.py index 3de43e7..f594f2b 100755 --- a/cfbe.py +++ b/cfbe.py @@ -4,11 +4,14 @@ import cherrypy from libbe import bugdir from jinja2 import Environment, FileSystemLoader from datetime import datetime +from optparse import OptionParser def datetimeformat(value, format='%B %d, %Y at %I:%M %p'): + """Takes a timestamp and revormats it into a human-readable string.""" return datetime.fromtimestamp(value).strftime(format) + template_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/templates' env = Environment(loader=FileSystemLoader(template_root)) env.filters['datetimeformat'] = datetimeformat @@ -23,6 +26,7 @@ class WebInterface: self.repository_name = self.bd.root.split('/')[-1] def get_common_information(self): + """Returns a dict of common information that most pages will need.""" possible_assignees = list(set([bug.assigned for bug in self.bd if unicode(bug.assigned) != 'None'])) possible_assignees.sort(key=unicode.lower) @@ -58,6 +62,10 @@ class WebInterface: @cherrypy.expose def index(self, status='open', assignee='', target=''): + """The main bug page. + Bugs can be filtered by assignee or target. + The bug database will be reloaded on each visit.""" + self.bd.load_all_bugs() if status == 'open': @@ -122,6 +130,7 @@ class WebInterface: raise cherrypy.HTTPRedirect('/bug?id=%s' % (shortname,), status=302) + @cherrypy.expose def edit(self, id, status=None, target=None, assignee=None, severity=None, summary=None): """The view that handles editing bug details.""" @@ -141,7 +150,26 @@ class WebInterface: raise cherrypy.HTTPRedirect('/bug?id=%s' % (shortname,), status=302) + +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 = '/Users/sjl/Documents/cherryflavoredbugseverywhere/cfbe.config' -# bug_root = '/Users/sjl/Desktop/be/.be' -bug_root = '/Users/sjl/Documents/cherryflavoredbugseverywhere/.be' -cherrypy.quickstart(WebInterface(bug_root), '/', config) +options = parse_arguments() +cherrypy.quickstart(WebInterface(options['bug_root']), '/', config) diff --git a/static/images/stripe.png b/static/images/stripe.png deleted file mode 100644 index a3c5e0ad2bb41b4c1e2d80af3cba0254bdad08c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 101 zcmeAS@N?(olHy`uVBq!ia0vp^tRT$61SFYwH*Nw_I-V|$AsjP(Pb%^;IB+l@WWE3Y z|E6U^#m}53OxC>Jpu+H?TgBA4`#-m5Eu+oV4#6YKVm#ji^)Yz5`njxgN@xNAusR(} diff --git a/templates/base.html b/templates/base.html index 0b44d81..1f0ab7b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -60,7 +60,6 @@