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
=== modified file 'webui.py'
--- webui.py 2009-07-10 19:42:24 +0000
+++ webui.py 2009-07-11 02:33:03 +0000
@@ -31,14 +31,13 @@
31class index(object):31class index(object):
32 """The main page of the status site."""32 """The main page of the status site."""
3333
34 def __init__(self):
35 from tarmac.config import TarmacConfig
36 config = TarmacConfig(sys.argv[2])
37 self.statusfile = config.log_file
38
34 def GET(self):39 def GET(self):
35 # XXX I cannot figure out how to make the config object from main40 tail = subprocess.Popen(('tail', '-n40', self.statusfile),
36 # available here.
37 # statusfile = config.log_file
38 from tarmac.config import TarmacConfig
39 statusfile = TarmacConfig(sys.argv[2]).log_file
40 print statusfile
41 tail = subprocess.Popen(('tail', '-n40', statusfile),
42 stdout = subprocess.PIPE,41 stdout = subprocess.PIPE,
43 stderr = subprocess.PIPE)42 stderr = subprocess.PIPE)
44 output, errput = tail.communicate()43 output, errput = tail.communicate()
@@ -49,8 +48,6 @@
49 if len(sys.argv) != 3:48 if len(sys.argv) != 3:
50 print "Please specify a port number and a project name: ./webui.py 8080 default"49 print "Please specify a port number and a project name: ./webui.py 8080 default"
51 return 150 return 1
52 projectname = sys.argv[2]
53 config = TarmacConfig(projectname)
54 app = web.application(urls, globals())51 app = web.application(urls, globals())
55 return app.run()52 return app.run()
5653

Subscribers

People subscribed via source and target branches