CMS 3D CMS Logo

Public Member Functions

webApp::Server Class Reference

List of all members.

Public Member Functions

def index
def showLogs
def ShowTable

Detailed Description

Definition at line 8 of file webApp.py.


Member Function Documentation

def webApp::Server::index (   self,
  args 
)

Definition at line 72 of file webApp.py.

00072                                :
00073                 print "Arguments :"
00074                 print args
00075                 selectRel = False
00076                 if 'reset' in args.keys():
00077                         cherrypy.session.clear()
00078                 it = 0
00079                 for row in web_results_display.GetLabels():
00080                         if not 'label' in cherrypy.session.keys():
00081                                 cherrypy.session['label'] = row[0]
00082                         break
00083                 if 'submit' in args.keys():
00084                         cherrypy.session['submit'] = args['submit']
00085                         cherrypy.session['label'] = args['label']
00086                         if 'release' in args.keys() and args['release'] != '':
00087                                 cherrypy.session['release'] = args['release']
00088                         if 'release' in cherrypy.session.keys() and args['release'] != cherrypy.session['release']:
00089                                 cherrypy.session['release'] = args['release']
00090                         if 'arch' in args.keys() and args['arch'] != '':
00091                                 cherrypy.session['arch'] = args['arch']
00092                         if 'arch' in cherrypy.session.keys() and args['arch'] != cherrypy.session['arch']:
00093                                 cherrypy.session['arch'] = args['arch']
00094                         if 'count' in args.keys() and args['count'].isdigit():
00095                                 cherrypy.session['count'] = args['count']
00096                         print "Session :"       
00097                         print cherrypy.session
00098                 if 'arch' in cherrypy.session.keys() and cherrypy.session['arch'] != ''  or 'release' in cherrypy.session.keys() and cherrypy.session['release'] != '':
00099                         selectRel = True
00100                 if 'count' in cherrypy.session.keys() and cherrypy.session['count'].isdigit():
00101                                 stCount = int(cherrypy.session['count'])
00102                 else:
00103                         stCount = 2;
00104                 
00105                 htmlCode = """
00106                 <html>
00107                         <META HTTP-EQUIV="REFRESH" CONTENT="60">
00108                         <head>
00109                                 <style type="text/css">
00110                                         button,
00111                                         input,
00112                                         select,
00113                                         textarea {
00114                                           font-size: 100%;
00115                                           margin: 0;
00116                                           vertical-align: baseline;
00117                                           *vertical-align: middle;
00118                                         }
00119                                         button, input {
00120                                           line-height: normal;
00121                                           *overflow: visible;
00122                                         }
00123                                         button::-moz-focus-inner, input::-moz-focus-inner {
00124                                           border: 0;
00125                                           padding: 0;
00126                                         }
00127                                         select {
00128                                         }
00129                                         button,
00130                                         input[type="submit"] {
00131                                           cursor: pointer;
00132                                           -webkit-appearance: button;
00133                                         }
00134                                         input[type="search"] {
00135                                           -webkit-appearance: textfield;
00136                                           -webkit-box-sizing: content-box;
00137                                           -moz-box-sizing: content-box;
00138                                           box-sizing: content-box;
00139                                         }
00140                                         a {
00141                                           color: #bfbfbf;
00142                                           text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
00143                                           text-decoration:none;
00144                                         }
00145                                         a:hover, .active a {
00146                                           color: #ffffff;
00147                                           text-decoration: none;
00148                                         }
00149                                         .links {
00150                                           background-color: #222;
00151                                           background-color: #222222;
00152                                           background-repeat: repeat-x;
00153                                           background-image: -khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));
00154                                           background-image: -moz-linear-gradient(top, #333333, #222222);
00155                                           background-image: -ms-linear-gradient(top, #333333, #222222);
00156                                           background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));
00157                                           background-image: -webkit-linear-gradient(top, #333333, #222222);
00158                                           background-image: -o-linear-gradient(top, #333333, #222222);
00159                                           background-image: linear-gradient(top, #333333, #222222);
00160                                           filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
00161                                           -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
00162                                           -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
00163                                           box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
00164                                         }
00165                                         #status, #header
00166                                         {
00167                                                 font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
00168                                                 width:100%;
00169                                                 border-collapse:collapse;
00170                                         }
00171                                         #header td 
00172                                         {
00173                                                 font-size:1em;
00174                                                 border:1px solid #67645B;
00175                                                 padding:3px 7px 2px 7px;
00176                                                 text-align:left;
00177                                         }
00178                                         #status td
00179                                         {
00180                                                 font-size:1em;
00181                                                 border:1px solid #67645B;
00182                                                 padding:3px 7px 2px 7px;
00183                                         }
00184                                         #status th 
00185                                         {
00186                                                 border:1px solid #67645B;
00187                                                 font-size:1.1em;
00188                                                 text-align:center;
00189                                                 padding-top:5px;
00190                                                 padding-bottom:4px;
00191                                                 background-color:#ECAE12;
00192                                                 color:#ffffff;
00193                                         }
00194                                         #controls
00195                                         {
00196                                                 font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
00197                                                 width:100%;
00198                                                 border-collapse:collapse;
00199                                         }
00200                                         #controls td 
00201                                         {
00202                                                 font-size:1.1em;
00203                                                 border:none;
00204                                                 padding-top:5px;
00205                                                 padding-bottom:4px;
00206                                                 text-align:left;
00207                                                 background-color:#393333;
00208                                                 color:#ffffff;
00209                                                 
00210                                         }
00211                                         .topbar {
00212                                           height: 40px;
00213                                           position: fixed;
00214                                           top: 0;
00215                                           left: 0;
00216                                           right: 0;
00217                                           z-index: 10000;
00218                                           overflow: visible;
00219                                           color: #ffffff;
00220                                           width: 100%;
00221                                         }
00222                                         .topbar form {
00223                                           float: left;
00224                                           margin: 5px 0 0 0;
00225                                           position: relative;
00226                                           filter: alpha(opacity=100);
00227                                           -khtml-opacity: 1;
00228                                           -moz-opacity: 1;
00229                                           opacity: 1;
00230                                         }
00231                                         .topbar input {
00232                                           background-color: #444;
00233                                           background-color: rgba(255, 255, 255, 0.3);
00234                                           font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
00235                                           font-size: 80%;
00236                                           font-weight: 13px;
00237                                           line-height: 1;
00238                                           padding: 4px 9px;
00239                                           color: #fff;
00240                                           color: rgba(255, 255, 255, 0.75);
00241                                           border: 1px solid #111;
00242                                           -webkit-border-radius: 4px;
00243                                           -moz-border-radius: 4px;
00244                                           border-radius: 4px;
00245                                           -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
00246                                           -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
00247                                           box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25);
00248                                           -webkit-transition: none;
00249                                           -moz-transition: none;
00250                                           transition: none;
00251                                         }
00252                                         .topbar input:-moz-placeholder {
00253                                           color: #e6e6e6;
00254                                         }
00255                                         .topbar input::-webkit-input-placeholder {
00256                                           color: #e6e6e6;
00257                                         }
00258                                         .topbar input:hover {
00259                                           background-color: #bfbfbf;
00260                                           background-color: rgba(255, 255, 255, 0.5);
00261                                           color: #fff;
00262                                         }
00263                                         .topbar input:focus, .topbar input.focused {
00264                                           outline: none;
00265                                           background-color: #fff;
00266                                           color: #404040;
00267                                           text-shadow: 0 1px 0 #fff;
00268                                           border: 0;
00269                                           padding: 5px 10px;
00270                                           -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
00271                                           -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
00272                                           box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
00273                                         }
00274                                         .topbar-inner, .topbar .fill {
00275                                           background-color: #222;
00276                                           background-color: #222222;
00277                                           background-repeat: repeat-x;
00278                                           background-image: -khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222));
00279                                           background-image: -moz-linear-gradient(top, #333333, #222222);
00280                                           background-image: -ms-linear-gradient(top, #333333, #222222);
00281                                           background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222));
00282                                           background-image: -webkit-linear-gradient(top, #333333, #222222);
00283                                           background-image: -o-linear-gradient(top, #333333, #222222);
00284                                           background-image: linear-gradient(top, #333333, #222222);
00285                                           filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);
00286                                           -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
00287                                           -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
00288                                           box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
00289                                         }
00290                                         .buts {
00291                                         float: right;
00292                                         }
00293                                 </style>
00294                         </head>
00295                         <body>
00296                                 <form method="post" action="index" >
00297                                                 <div class="topbar">
00298                                                         <div class="fill">
00299                                                                 <div class="container">
00300                                                                         <select name = "label">"""
00301                 curs = web_results_display.GetLabels()
00302                 for row in curs:
00303                         if str(row[0]) == cherrypy.session['label']:
00304                                 htmlCode += """<option value = """+str(row[0])+""" selected = "selected">"""+str(row[0])+"""</option>
00305                                 """
00306                         else:
00307                                 htmlCode += """<option value = """+str(row[0])+""">"""+str(row[0])+"""</option>
00308                                 """
00309                 htmlCode+="""</select>
00310                         """
00311                 if 'release' in cherrypy.session.keys():
00312                         htmlCode += """Candidate Release:<input type="text" name="release" size="30" maxlength="50" value=\""""+str(cherrypy.session['release'])+""""\"/>
00313                         """
00314                 else:
00315                         htmlCode += """Candidate Release:<input type="text" name="release" size="30" maxlength="50"/>
00316                         """
00317                 if 'arch' in cherrypy.session.keys():
00318                         htmlCode += """Candidate Architecture:<input type="text" name="arch" size="15" maxlength="30" value=\""""+cherrypy.session['arch']+""""\"/>
00319                         """
00320                 else:
00321                         htmlCode += """Candidate Architecture:<input type="text" name="arch" size="15" maxlength="30" />
00322                         """
00323                 if 'count' in cherrypy.session.keys():
00324                         htmlCode += """Number of results:<input type="text" name="count" size="1" maxlength="4" value=\""""+cherrypy.session['count']+""""\"/>
00325                         """
00326                 else:
00327                         htmlCode += """Number of results:<input type="text" name="count" size="4" maxlength="4" />
00328                         """
00329                 htmlCode +="""<div class = "buts"><input type="submit" name="submit" value="Refresh"/>
00330                                                         <input type="submit" name="reset" value="Reset"/>
00331                                                 </div></div></div></div>
00332                                                 <br>
00333                                 </form>
00334                         """
00335                 if(selectRel == True):
00336                         if 'arch' in cherrypy.session.keys() and 'release' in cherrypy.session.keys():
00337                                 DBdata = web_results_display.GetReleasesHeaders(cherrypy.session['label'], cherrypy.session['release'], cherrypy.session['arch'])
00338                         elif 'release' in cherrypy.session.keys():
00339                                 DBdata = web_results_display.GetReleasesHeaders(cherrypy.session['label'], cherrypy.session['release'])
00340                         elif 'arch' in cherrypy.session.keys():
00341                                 DBdata = web_results_display.GetReleasesHeaders(cherrypy.session['label'], "", cherrypy.session['arch'])
00342                         counter =0
00343                         for data in DBdata:
00344                                 counter += 1
00345                                 if stCount != 0:
00346                                         htmlCode += self.ShowTable( data, cherrypy.session['label'])
00347                                         stCount = stCount -1
00348                         if (counter == 0):
00349                                 htmlCode += """<h3> No entries found </h3>"""
00350                 else:
00351                         DBdata = web_results_display.GetResultHeaders(cherrypy.session['label'])
00352                         for data in DBdata:
00353                                 if stCount != 0:
00354                                         htmlCode += self.ShowTable(data, cherrypy.session['label'])
00355                                         stCount = stCount -1
00356                 return htmlCode
00357 
def webApp::Server::showLogs (   self,
  args 
)

Definition at line 359 of file webApp.py.

00359                                   :
00360                 runID = int(args['runID'])
00361                 label = args['label']
00362 
00363                 logInfo = "<html><head></head><body><pre>\n"
00364                 logInfo += web_results_display.GetReadLogStatus(label, runID)
00365                 logInfo += '\n</pre></body></html>'
00366                 return logInfo
00367                                 
def webApp::Server::ShowTable (   self,
  curs,
  label 
)

Definition at line 10 of file webApp.py.

00010                                         :
00011                 res1 = web_results_display.GetRunResults(curs[0])
00012                 # only 
00013                 for rows in res1:
00014                         res2, stCount = web_results_display.GetResultsList(rows[0])
00015                         break
00016                 #print stCount
00017                 Code ="""
00018                         <table id="header" bgcolor="#D8D8D8">
00019                                         <tr>
00020                                         <td colspan = "2">Test Sequence:
00021                                         <b>"""+str(curs[2])+"""</b>&nbsp&nbsp&nbsp&nbsp
00022                                         RunID:
00023                                         """+str(curs[0])+"""&nbsp&nbsp&nbsp&nbsp
00024                                         Time:
00025                                         """+str(curs[1])+"""
00026                                         </td>
00027                                         <tr>
00028                                         <td>
00029                                         Candidate:
00030                                         <b>"""+str(curs[3])+"""</b>&nbsp&nbsp&nbsp&nbsp
00031                                         Architecture:
00032                                         <b>"""+str(curs[4])+"""</b>
00033                                         </td>
00034                                         <td class="links"><a href="showLogs?runID="""+str(curs[0])+"""&label="""+label+"""">&gt&gt Logfile</a></td>
00035                                         </tr>
00036                         </table>
00037                         <table id="status">
00038                         """
00039                 Code +="""
00040                                         <tr>
00041                                                 <!--<th rowspan="2" colspan = "2">Reference releases</th>-->
00042                                                 <th>Reference release</th>
00043                                                 <th>Reference architecture</th>
00044                                         
00045                 """
00046                 for i in range (0, stCount):
00047                         Code += """<th>"""+str(res2[i][2])+"""</th>
00048                         """
00049                 Code +="""</tr>"""
00050                 for rows in res1:
00051                         res2, stCount = web_results_display.GetResultsList(rows[0])
00052                         Code += """<tr>
00053                                         <td align="left" >"""+str(rows[1])+"""</td>
00054                                         <td>"""+str(rows[2])+"""</td>
00055                         """
00056                         for i in range (0, stCount):
00057                                 if(res2[i][1] == 0):
00058                                         Code +="""<td align="center" bgcolor ="#A7C942"><b>OK</b></td>
00059                                         """
00060                                 else:
00061                                         Code +="""<td align="center" bgcolor ="#FF0000"><b>Failure</b></td>
00062                                         """
00063                         Code += """</tr></tr>
00064                         """
00065                 Code += """</table><hr>
00066                 """
00067                 Code += """
00068                 </body>
00069                 </html>
00070                 """
00071                 return Code