Merge lp:~statik/tarmac/web-status-cleanup into lp:tarmac

Proposed by Elliot Murphy
Status: Merged
Approved by: Paul Hummer
Approved revision: 132
Merged at revision: not available
Proposed branch: lp:~statik/tarmac/web-status-cleanup
Merge into: lp:tarmac
Diff against target: None lines
To merge this branch: bzr merge lp:~statik/tarmac/web-status-cleanup
Reviewer Review Type Date Requested Status
Paul Hummer Approve
Review via email: mp+8598@code.launchpad.net

Commit message

Minor change to the web ui so that Config isn't loaded at each request.

To post a comment you must log in.
Revision history for this message
Elliot Murphy (statik) wrote :

Now that I understand how the reloader works, don't reload the config on every web request.

Revision history for this message
Paul Hummer (rockstar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'webui.py'
2--- webui.py 2009-07-10 19:42:24 +0000
3+++ webui.py 2009-07-11 02:33:03 +0000
4@@ -31,14 +31,13 @@
5 class index(object):
6 """The main page of the status site."""
7
8+ def __init__(self):
9+ from tarmac.config import TarmacConfig
10+ config = TarmacConfig(sys.argv[2])
11+ self.statusfile = config.log_file
12+
13 def GET(self):
14- # XXX I cannot figure out how to make the config object from main
15- # available here.
16- # statusfile = config.log_file
17- from tarmac.config import TarmacConfig
18- statusfile = TarmacConfig(sys.argv[2]).log_file
19- print statusfile
20- tail = subprocess.Popen(('tail', '-n40', statusfile),
21+ tail = subprocess.Popen(('tail', '-n40', self.statusfile),
22 stdout = subprocess.PIPE,
23 stderr = subprocess.PIPE)
24 output, errput = tail.communicate()
25@@ -49,8 +48,6 @@
26 if len(sys.argv) != 3:
27 print "Please specify a port number and a project name: ./webui.py 8080 default"
28 return 1
29- projectname = sys.argv[2]
30- config = TarmacConfig(projectname)
31 app = web.application(urls, globals())
32 return app.run()
33

Subscribers

People subscribed via source and target branches