ATLAS Offline Software
Loading...
Searching...
No Matches
python.html.AtlRunQueryPageMaker.PageMaker Class Reference
Collaboration diagram for python.html.AtlRunQueryPageMaker.PageMaker:

Public Member Functions

 makePage (cls, body, origQuery=None, extraReplace=None, removeExamples=False)
 getBlankPage (cls, removeExamples=False)

Protected Member Functions

 _copySomeFilesToCache (cls)

Detailed Description

Definition at line 6 of file AtlRunQueryPageMaker.py.

Member Function Documentation

◆ _copySomeFilesToCache()

python.html.AtlRunQueryPageMaker.PageMaker._copySomeFilesToCache ( cls)
protected

Definition at line 46 of file AtlRunQueryPageMaker.py.

46 def _copySomeFilesToCache(cls):
47 from subprocess import call
48 from CoolRunQuery.AtlRunQueryQueryConfig import QC
49 call("mkdir -p %s/css" % QC.datapath, shell=True)
50 call("cp html/css/atlas-runquery-lb.css %s/css/" % QC.datapath, shell=True)

◆ getBlankPage()

python.html.AtlRunQueryPageMaker.PageMaker.getBlankPage ( cls,
removeExamples = False )

Definition at line 33 of file AtlRunQueryPageMaker.py.

33 def getBlankPage(cls, removeExamples=False):
34 if '/var/vhost' in os.path.dirname(__file__):
35 page = open("%s/index.html" % os.path.dirname(__file__).replace('CoolRunQuery/html',''))
36 else:
37 page = open("%s/atlas-runquery.html" % os.path.dirname(__file__).replace('python/CoolRunQuery/html','html'))
38 s = page.read()
39 top, bottom = re.match("(.*)<!--INSERTQUERYRESULT-->(.*)", s, re.S|re.M).group(1,2)
40 if removeExamples:
41 top = "".join(re.match("(.*)<!--START_EXAMPLES-->.*<!--END_EXAMPLES-->(.*)", top, re.S|re.M).group(1,2))
42 return (top,bottom)
43
44
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310

◆ makePage()

python.html.AtlRunQueryPageMaker.PageMaker.makePage ( cls,
body,
origQuery = None,
extraReplace = None,
removeExamples = False )

Definition at line 9 of file AtlRunQueryPageMaker.py.

9 def makePage(cls, body, origQuery=None, extraReplace=None, removeExamples=False):
10 from CoolRunQuery.AtlRunQueryQueryConfig import QC
11 (top, bottom) = cls.getBlankPage(removeExamples=removeExamples)
12 # put in the original query
13 if origQuery is not None:
14 top = top.replace('name="q"','name="q" value="%s"' % origQuery)
15
16 # extra replacements
17 if extraReplace is not None:
18 for pat,repl in extraReplace:
19 p = re.compile(pat,re.S)
20 top = p.sub(repl, top)
21 bottom = p.sub(repl, bottom)
22
23 fh = open("%s/index.html" % QC.datapath, "w")
24 print (top, file = fh)
25 print (body, file = fh)
26 print (bottom, file = fh)
27 fh.close()
28
29 cls._copySomeFilesToCache()
30
31

The documentation for this class was generated from the following file: