Changeset 6646


Ignore:
Timestamp:
Mar 27, 2009, 3:11:48 PM (15 years ago)
Author:
rwilson
Message:

Tweaking associated with patong auto validation.

Location:
anuga_core/source/anuga/utilities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/log.py

    r6638 r6646  
    77Use it this way:
    88    import anuga.utilities.log as log
     9    log.console_logging_level = log.DEBUG
    910    log.debug('A message at DEBUG level')
    1011    log.info('Another message, INFO level')
     
    4748log_filename = './anuga.log'
    4849
     50# set module variables so users don't have to do 'import logging'.
     51CRITICAL = logging.CRITICAL
     52ERROR = logging.ERROR
     53WARNING = logging.WARNING
     54INFO = logging.INFO
     55DEBUG = logging.DEBUG
     56NOTSET = logging.NOTSET
     57
    4958
    5059################################################################################
     
    8594
    8695        # tell the world how we are set up
    87         start_msg = ("\nLogfile is '%s' with logging level of %s, "
     96        start_msg = ("Logfile is '%s' with logging level of %s, "
    8897                     "console logging level is %s"
    8998                     % (log_filename,
  • anuga_core/source/anuga/utilities/system_tools.py

    r6645 r6646  
    302302# @note Will try using environment variable PROXY_PASSWORD for proxy password.
    303303def get_web_file(file_url, file_name, auth=None, blocksize=1024*1024):
    304     '''Get a file from the web.'''
     304    '''Get a file from the web.
     305
     306    Note the tortuous path to the code below:
     307    Q. How do we get a file on a server into patong validation?
     308    A. wget!
     309    Q. On Windows?
     310    A. Damn! wget is UNIX only.  Use python module urllib!  One line of code!
     311    Q. Through a proxy?
     312    A. Damn! urllib fails.  Use urllib2!
     313    Q. How do we make it easy for the user to supply auth info?
     314    A. Pass in and return an 'auth' tuple!  And use environment variables!
     315    Q. How do we stop a caching proxy from defeating updates?
     316    A. Append a unique, ignored, string on each fetched URL!
     317
     318    Furtive look over the shoulder to see what other problems are approaching!
     319    '''
    305320
    306321    # Simple fetch, if fails, check for proxy error
    307322    try:
    308         urllib.urlretrieve(file_url, file_name)
     323        urllib.urlretrieve(file_url, file_name)     # original 'line of code'
    309324        return None     # no proxy, no auth required
    310325    except IOError, e:
     
    330345    # Get auth info from user if still not supplied
    331346    if httpproxy is None or proxyuser is None or proxypass is None:
     347        print '----------------------------------------------------'
    332348        print 'You need to supply proxy authentication information:'
    333349        if httpproxy is None:
     
    337353        if proxypass is None:
    338354            proxypass = getpass.getpass('proxy password: ')
     355        print '----------------------------------------------------'
    339356
    340357    # the proxy URL cannot start with 'http://'
     
    343360        httpproxy = httpproxy.replace('http://', '', 1)
    344361
    345     # open 'net file
     362    # open remote file
    346363    proxy = urllib2.ProxyHandler({'http': 'http://' + proxyuser
    347364                                              + ':' + proxypass
Note: See TracChangeset for help on using the changeset viewer.