Changeset 710 for branches


Ignore:
Timestamp:
Oct 27, 2007 5:15:45 AM (12 years ago)
Author:
stefan
Message:

allow to have parameters that are defined only in the default file and not the users parameter file

Location:
branches/testScripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/testScripts/NBemail.py

    r706 r710  
    66import smtplib
    77
    8 import NBuserParameters
    98import NBprojectConfig
    109import NBlogMessages
     10
     11execfile('NBuserParametersDefault.py')
     12execfile('NBuserParameters.py')
    1113
    1214#------------------------------------------------------------------------
     
    2729  curDir = os.getcwd()
    2830
    29   toAddrs = [unscrambleAddress(NBuserParameters.MY_EMAIL_ADDR)]
    30   if NBprojectConfig.PROJECT_EMAIL_ADDRS.has_key(project) \
    31      and \
    32      NBuserParameters.SEND_MAIL_TO_PROJECT_MANAGER:
     31  toAddrs = [unscrambleAddress(MY_EMAIL_ADDR)]
     32  if SEND_MAIL_TO_PROJECT_MANAGER and NBprojectConfig.PROJECT_EMAIL_ADDRS.has_key(project) :
    3333    scrambledEmailAddress=NBprojectConfig.PROJECT_EMAIL_ADDRS[project]
    3434    unscrambledEmailAddress=unscrambleAddress(scrambledEmailAddress)
     
    9494def send(toAddrs,subject,message):
    9595
    96   sender = unscrambleAddress(NBuserParameters.SENDER_EMAIL_ADDR) 
     96  sender = unscrambleAddress(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(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')
     102  if len(EMAIL_STOREFILE) > 0 and not EMAIL_STOREFILE.isspace() :
     103    NBlogMessages.writeMessage( '  store email in file '+EMAIL_STOREFILE)
     104    emailfile=open(NIGHTLY_BUILD_ROOT_DIR+'/'+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(NBuserParameters.SMTP_PASSWORD_FILENAME) :
    112     pwFilePtr = open(NBuserParameters.SMTP_PASSWORD_FILENAME,'r')
     111  if os.path.isfile(SMTP_PASSWORD_FILENAME) :
     112    pwFilePtr = open(SMTP_PASSWORD_FILENAME,'r')
    113113    smtppass  = pwFilePtr.read().strip()
    114114    #print smtppass
    115115    pwFilePtr.close()
    116116  else :
    117     NBlogMessages.writeMessage( "Failure reading pwFileName=" + NBuserParameters.SMTP_PASSWORD_FILENAME )
     117    NBlogMessages.writeMessage( "Failure reading pwFileName=" + SMTP_PASSWORD_FILENAME )
    118118    sys.exit(1)
    119119   
    120   session = smtplib.SMTP(NBuserParameters.SMTP_SERVER_NAME,NBuserParameters.SMTP_SERVER_PORT)
     120  session = smtplib.SMTP(SMTP_SERVER_NAME,SMTP_SERVER_PORT)
    121121  #session.set_debuglevel(1)
    122   if NBuserParameters.SMTP_SSL_SERVER==1 :
     122  if SMTP_SSL_SERVER==1 :
    123123    session.ehlo('x')
    124124    session.starttls()
    125125    session.ehlo('x') 
    126   session.login(unscrambleAddress(NBuserParameters.SMTP_USER_NAME),smtppass)
     126  session.login(unscrambleAddress(SMTP_USER_NAME),smtppass)
    127127
    128128  rc = session.sendmail(sender,toAddrs,msgWHeader)
  • branches/testScripts/NBlogMessages.py

    r706 r710  
    22
    33import time
    4 import NBuserParameters
     4
     5execfile('NBuserParametersDefault.py')
     6execfile('NBuserParameters.py')
    57
    68#TODO: one could open the logfile once in the beginning, set it to sys.stdout, flush after each message, and close it finally
     
    1214  logMsg = time.ctime(time.time())+': '
    1315  logMsg += msg
    14   if NBuserParameters.LOGPRINT :
     16  if LOGPRINT :
    1517    print logMsg
    16   if len(NBuserParameters.LOGFILE) > 0 and not NBuserParameters.LOGFILE.isspace() :
    17     logfile=open(NBuserParameters.NIGHTLY_BUILD_ROOT_DIR+'/'+NBuserParameters.LOGFILE, 'a')
     18  if len(LOGFILE) > 0 and not LOGFILE.isspace() :
     19    logfile=open(NIGHTLY_BUILD_ROOT_DIR+'/'+LOGFILE, 'a')
    1820    logfile.write(logMsg+'\n')
    1921#    logfile.flush()
Note: See TracChangeset for help on using the changeset viewer.