annotate bin/starttreepkgweb.py @ 250:b3f9cc956acc

Make the Status class usable without a filename and provide methods to (de-)serialize to and from memory to make writing tests easier.
author Bernhard Herzog <bh@intevation.de>
date Thu, 09 Apr 2009 18:20:04 +0000
parents a30351c91a68
children 1fcdffbeb9de
rev   line source
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python2.4
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
2 # Copyright (C) 2007, 2008 by Intevation GmbH
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
3 # Authors:
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
4 # Bernhard Herzog <bh@intevation.de>
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
5 #
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
8
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
9 """Starts the tree packager webinterface"""
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
10
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
11 import sys
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 import os
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 from optparse import OptionParser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
14
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15 import treepkgcmd
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16 from treepkg.options import create_parser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 from treepkg.web import runserver
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 def parse_commandline():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
20 parser = create_parser()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
21 parser.set_defaults(cherrypy_config=os.path.join(treepkgcmd.topdir,
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
22 "cherrypy.cfg"),
154
a30351c91a68 Make status-by-startdate.html the default template. Sorting by date is
Bernhard Herzog <bh@intevation.de>
parents: 152
diff changeset
23 status_template="status-by-startdate.html")
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
24 parser.add_option("--cherrypy-config",
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
25 help=("The cherrypy config file for the web interface."
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26 " Default cherrypy.cfg"))
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
27 parser.add_option("--status-template",
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
28 help=("The template file to use for the status page."
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
29 " Relative filenames are interpreted"
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
30 " relative to the web subdirectory."
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
31 " Default is status-by-revision.html."))
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
32 return parser.parse_args()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
33
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
34 def main():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
35 options, args = parse_commandline()
152
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
36 runserver(options.config_file, options.cherrypy_config,
4adcb15cbdfb Let the user supply the filename of the template to use for the status page.
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
37 status_template=options.status_template)
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
38
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
39 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)