ATLAS Offline Software
WebPlots.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2 
3 """
4 ATLAS beam spot server for pre-made web plots (e.g. weekly beam spot history).
5 """
6 
7 __author__ = 'Juerg Beringer'
8 __version__ = 'WebPlots.py atlas/athena'
9 
10 from BeamSpotWebPage import BeamSpotWebPage
11 
12 import sys, os, time
13 
14 errorPage = """\
15 <div class="errormsg">
16 We're sorry - this plot (%s) is currently not available.
17 </div>
18 """
19 
20 page = """
21 <div class="boldtext">
22 Last updated: %s
23 </div>
24 <img id="webplot" src="/webplots/%s">
25 """
26 
28 
29  def __init__(self):
30  BeamSpotWebPage.__init__(self)
31  self.pageConfig['pageTitle'] = 'ATLAS Beam Spot Overview'
32 
33  def content(self,**args):
34  plotName = args.get('plot','summary-weekly.gif')
35  webPlotDir = self.globalConfig['webPlotDir']
36  filePath = os.path.join(webPlotDir,plotName)
37  if not os.path.exists(filePath):
38  return errorPage % plotName
39  lastUpdate = time.ctime(os.path.getctime(filePath))
40  return page % (lastUpdate,plotName)
WebPage.WebPage.globalConfig
globalConfig
Definition: WebPage.py:290
WebPlots.WebPlots
Definition: WebPlots.py:27
WebPlots.WebPlots.__init__
def __init__(self)
Definition: WebPlots.py:29
WebPlots.WebPlots.content
def content(self, **args)
Definition: WebPlots.py:33
WebPage.WebPage.pageConfig
pageConfig
Definition: WebPage.py:273
BeamSpotWebPage.BeamSpotWebPage
Definition: BeamSpotWebPage.py:47