Changeset 1721:921b3780c6cc in orange-bioinformatics for server_update/updater.py


Ignore:
Timestamp:
09/14/12 12:20:53 (19 months ago)
Author:
markotoplak
Branch:
default
Message:

Moved common functionality of the server files update scripts to a separate file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server_update/updater.py

    r1717 r1721  
    1 import sys, os 
    21import subprocess 
    32import time, glob 
    4 import optparse 
    53 
    6 from getopt import getopt 
    74from datetime import datetime 
    85 
    9 usage="""usage: %prog [options] [update_script ...] 
    10  
    11 Run update scripts""" 
    12  
    13 parser = optparse.OptionParser(usage=usage) 
    14 parser.add_option("-u", "--user", help="User name") 
    15 parser.add_option("-p", "--password", help="Password") 
    16 parser.add_option("-l", "--log-dir", dest="log_dir", help="Directory to store the logs", default="./") 
    17 parser.add_option("-m", "--mailto", help="e-mail the results to EMAIL", metavar="EMAIL", default=None) 
    18  
    19 option, args = parser.parse_args() 
     6from common import * 
    207 
    218if not args: 
     
    4532 
    4633def files_report(): 
    47   import orngServerFiles as sf 
    48   sf = sf.ServerFiles() 
    49   html = [] 
    50   for domain in sf.listdomains(): 
    51       if domain not in ["demo", "demo2", "test", "gad"]: 
    52           allinfo = sf.allinfo(domain) 
    53           html += ["<h2>%s</h2>" % domain, 
    54                    "<table><tr><th>Title</th><th>Date</th><th>Filename</th></tr>"] + \ 
    55                   ["<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % (info["title"], info["datetime"], file) \ 
    56                    for file, info in allinfo.items()] + \ 
    57                   ["</table>"] 
    58   return "\n".join(html) 
     34    sf = serverfiles.ServerFiles() 
     35    html = [] 
     36    for domain in sf.listdomains(): 
     37        if domain not in ["demo", "demo2", "test", "gad"]: 
     38            allinfo = sf.allinfo(domain) 
     39            html += ["<h2>%s</h2>" % domain, 
     40                     "<table><tr><th>Title</th><th>Date</th><th>Filename</th></tr>"] + \ 
     41                    ["<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % (info["title"], info["datetime"], file) \ 
     42                     for file, info in allinfo.items()] + \ 
     43                    ["</table>"] 
     44    return "\n".join(html) 
    5945   
    6046open(os.path.join(option.log_dir, "serverFiles.html"), "wb").write(files_report()) 
Note: See TracChangeset for help on using the changeset viewer.