diff --git a/tconfpy.py b/tconfpy.py index 082e01f..c1872ad 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.0 2003/12/13 01:00:28 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.100 2004/03/09 08:00:01 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -15,8 +15,9 @@ DATE = "2003-2004" OWNER = "TundraWare Inc." RIGHTS = "All Rights Reserved" -COPYRIGHT = "Copyright %s %s %s %s. " % (CPRT, DATE, OWNER, RIGHTS) +COPYRIGHT = "Copyright %s %s %s, %s." % (CPRT, DATE, OWNER, RIGHTS) PROGINFO = PROGNAME + " " + VERSION +BANNER = "%s - %s" % (PROGINFO, COPYRIGHT) #----------------------------------------------------------# @@ -47,17 +48,15 @@ -##### +########## # Constants -##### +########## -FALSE = 0 == 1 # Booleans -TRUE = not FALSE +MSGCOL = 10 # Column to start message output - -##### +########## # Literals -##### +########## #----------------------------------------------------------# @@ -65,22 +64,31 @@ #----------------------------------------------------------# -##### +########## # Error Messages -##### +########## eERROR = "ERROR" -##### +########## # Informational Messages -##### +########## + +iERRTST = "Test Error Message - Ignore" +iWARNTST = "Test Warning Message Ignore" - -##### +########## # Prompts -##### +########## + + +########## +# Warning Messages +########## + +wWARNING = "WARNING" @@ -104,24 +112,42 @@ #----------------------------------------------------------# -##### -# Print An Error Message -##### +########## +# Create An Error Message +########## -def errmsg(emsg): - print PROGINFO + " " + eERROR + ": " + emsg +def ErrorMsg(error): + + return mkmsg(error + "!", eERROR) -# End of 'errmsg()' +# End of 'ErrorMsg()' -##### -# Run This When Directly Invoked Instead Of Imported -##### +########## +# Construct A Standard Application Message String +########## -def direct(): - print PROGINFO - print COPYRIGHT - errmsg("Test Error Message Function") +def mkmsg(msg, msgtype=""): + + if msgtype: + sep = ":" + + pad = " " * (MSGCOL - len(msgtype)) + + return "%s - %s%s%s%s" % (PROGINFO, msgtype,sep, pad, msg) + +# End of 'mkmsg()' + + +########## +# Create A Warning Message +########## + +def WarningMsg(warning): + + return mkmsg(warning + "!", wWARNING) + +# End of 'WarningMsg()' #----------------------------------------------------------# @@ -129,4 +155,9 @@ #----------------------------------------------------------# if __name__ == '__main__': - direct() + + print BANNER + print ErrorMsg(iERRTST) + print WarningMsg(iWARNTST) + +