Changeset 4131

Show
Ignore:
Timestamp:
02/19/09 20:22:07 (4 years ago)
Author:
gpolo
Message:

Changed filename format to not cause troubles under Windows (':' is not accepted)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/umitCore/Scheduler.py

    r4129 r4131  
    2828import warnings 
    2929import subprocess 
     30from datetime import datetime 
    3031from ConfigParser import ConfigParser 
    3132 
     
    4748    servicemanager = lambda: None 
    4849    servicemanager.RunningAsService = lambda: False 
     50 
     51 
     52def format_asctime(date): 
     53    """Format a datetime.date almost like time.asctime, except this one 
     54    doesn't use ':' for the time so it can be used as a filename under 
     55    Windows.""" 
     56    return datetime.strftime(date, '%a %b %d %Hh%Mm%Ss %Y') 
    4957 
    5058 
     
    684692                    server = smtp['server'] 
    685693                    port = smtp['port'] 
    686                     curr_time = time.ctime() 
     694                    curr_time = format_asctime(datetime.now()) 
    687695                    orig_output = scan.get_xml_output_file() 
    688696                    new_file_output = os.path.join( 
    689697                            os.path.dirname(orig_output), 
    690                             curr_time + "-" + opts[3]) 
     698                            "%s (%s)" % (curr_time, opts[3])) 
    691699 
    692700                    fd_wcont = open(new_file_output, 'w')