Changeset 706 for branches


Ignore:
Timestamp:
Oct 26, 2007 2:54:47 PM (12 years ago)
Author:
jpfasano
Message:

Some cleanup dealing with removal of NBuserConfig.py

Location:
branches/testScripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/testScripts/NBemail.py

    r704 r706  
    66import smtplib
    77
    8 import NBuserConfig
     8import NBuserParameters
    99import NBprojectConfig
    1010import NBlogMessages
     
    2727  curDir = os.getcwd()
    2828
    29   toAddrs = [unscrambleAddress(NBuserConfig.MY_EMAIL_ADDR)]
     29  toAddrs = [unscrambleAddress(NBuserParameters.MY_EMAIL_ADDR)]
    3030  if NBprojectConfig.PROJECT_EMAIL_ADDRS.has_key(project) \
    3131     and \
    32      NBuserConfig.SEND_MAIL_TO_PROJECT_MANAGER:
     32     NBuserParameters.SEND_MAIL_TO_PROJECT_MANAGER:
    3333    scrambledEmailAddress=NBprojectConfig.PROJECT_EMAIL_ADDRS[project]
    3434    unscrambledEmailAddress=unscrambleAddress(scrambledEmailAddress)
     
    9494def send(toAddrs,subject,message):
    9595
    96   sender = unscrambleAddress(NBuserConfig.SENDER_EMAIL_ADDR) 
     96  sender = unscrambleAddress(NBuserParameters.SENDER_EMAIL_ADDR) 
    9797  msgWHeader = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n"
    9898       % (sender, ", ".join(toAddrs), subject))
     
    100100
    101101  #store email in a file instead of sending
    102   if len(NBuserConfig.EMAIL_STOREFILE) > 0 and not NBuserConfig.EMAIL_STOREFILE.isspace() :
    103     NBlogMessages.writeMessage( '  store email in file '+NBuserConfig.EMAIL_STOREFILE)
    104     emailfile=open(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR+'/'+NBuserConfig.EMAIL_STOREFILE, 'a')
     102  if len(NBuserParameters.EMAIL_STOREFILE) > 0 and not NBuserParameters.EMAIL_STOREFILE.isspace() :
     103    NBlogMessages.writeMessage( '  store email in file '+NBuserParameters.EMAIL_STOREFILE)
     104    emailfile=open(NBuserParameters.NIGHTLY_BUILD_ROOT_DIR+'/'+NBuserParameters.EMAIL_STOREFILE, 'a')
    105105    emailfile.write(msgWHeader)
    106106    emailfile.write("\n============ EMAIL END ======================================\n")
     
    109109
    110110  # Get smtp server password
    111   if os.path.isfile(NBuserConfig.SMTP_PASSWORD_FILENAME) :
    112     pwFilePtr = open(NBuserConfig.SMTP_PASSWORD_FILENAME,'r')
     111  if os.path.isfile(NBuserParameters.SMTP_PASSWORD_FILENAME) :
     112    pwFilePtr = open(NBuserParameters.SMTP_PASSWORD_FILENAME,'r')
    113113    smtppass  = pwFilePtr.read().strip()
    114114    #print smtppass
    115115    pwFilePtr.close()
    116116  else :
    117     NBlogMessages.writeMessage( "Failure reading pwFileName=" + NBuserConfig.SMTP_PASSWORD_FILENAME )
     117    NBlogMessages.writeMessage( "Failure reading pwFileName=" + NBuserParameters.SMTP_PASSWORD_FILENAME )
    118118    sys.exit(1)
    119119   
    120   session = smtplib.SMTP(NBuserConfig.SMTP_SERVER_NAME,NBuserConfig.SMTP_SERVER_PORT)
     120  session = smtplib.SMTP(NBuserParameters.SMTP_SERVER_NAME,NBuserParameters.SMTP_SERVER_PORT)
    121121  #session.set_debuglevel(1)
    122   if NBuserConfig.SMTP_SSL_SERVER==1 :
     122  if NBuserParameters.SMTP_SSL_SERVER==1 :
    123123    session.ehlo('x')
    124124    session.starttls()
    125125    session.ehlo('x') 
    126   session.login(unscrambleAddress(NBuserConfig.SMTP_USER_NAME),smtppass)
     126  session.login(unscrambleAddress(NBuserParameters.SMTP_USER_NAME),smtppass)
    127127
    128128  rc = session.sendmail(sender,toAddrs,msgWHeader)
  • branches/testScripts/NBlogMessages.py

    r681 r706  
    22
    33import time
    4 import NBuserConfig
     4import NBuserParameters
    55
    66#TODO: one could open the logfile once in the beginning, set it to sys.stdout, flush after each message, and close it finally
     
    1212  logMsg = time.ctime(time.time())+': '
    1313  logMsg += msg
    14   if NBuserConfig.LOGPRINT :
     14  if NBuserParameters.LOGPRINT :
    1515    print logMsg
    16   if len(NBuserConfig.LOGFILE) > 0 and not NBuserConfig.LOGFILE.isspace() :
    17     logfile=open(NBuserConfig.NIGHTLY_BUILD_ROOT_DIR+'/'+NBuserConfig.LOGFILE, 'a')
     16  if len(NBuserParameters.LOGFILE) > 0 and not NBuserParameters.LOGFILE.isspace() :
     17    logfile=open(NBuserParameters.NIGHTLY_BUILD_ROOT_DIR+'/'+NBuserParameters.LOGFILE, 'a')
    1818    logfile.write(logMsg+'\n')
    1919#    logfile.flush()
  • branches/testScripts/NBprojectConfig.py

    r702 r706  
    22
    33import os
    4 import NBuserConfig
    54
    65#----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.