diff --git a/tconfpy.py b/tconfpy.py index c448a7b..6acc5e4 100755 --- a/tconfpy.py +++ b/tconfpy.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "tconfpy" -RCSID = "$Id: tconfpy.py,v 1.163 2004/04/07 08:54:08 tundra Exp $" +RCSID = "$Id: tconfpy.py,v 1.164 2004/04/08 15:51:26 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -281,6 +281,7 @@ eBADLEGALVAL = "Type Of One Or More LegalVals Does Not Agree With Type Declared" eBADMINMAX = "Type Of Min Or Max Value Not Appropriate For" eIFBAD = "'%s' Or '%s' Missing" % (EQUIV, NOTEQUIV) +eLEGALVALLIST = "The LegalVal Attribute Is Wrong Type (Must Be A List)" eNOTDESCRIPT = "Invalid Descriptor Type" eNOVARREF = "Must Have At Least One Variable Reference" eSTARTUP = "" @@ -446,14 +447,27 @@ dt = des.Type + # Make sure default value agrees with variable type + if des.Default and type(des.Default) != dt: desok = False ErrorMsg("eDESCRIPTBAD", (eBADDEFAULT, sym)) - for lv in des.LegalVals: - if type(lv) != dt: - desok = False - ErrorMsg("eDESCRIPTBAD", (eBADLEGALVAL, sym)) + # Make sure that LegalVals is a list type + + if type(des.LegalVals) != type([]): + desok = False + ErrorMsg("eDESCRIPTBAD", (eLEGALVALLIST, sym)) + + # Then check each value in the list for type agreement + else: + + for lv in des.LegalVals: + if type(lv) != dt: + desok = False + ErrorMsg("eDESCRIPTBAD", (eBADLEGALVAL, sym)) + + # Make sure min and max limits are of the correct type for mm in (des.Min, des.Max): @@ -489,7 +503,7 @@ return retobj - # Symbol Table passed to API was OK, sokeep going + # Symbol Table passed to API was OK, so keep going # Make sure the symbol table has a valid namespace @@ -498,6 +512,14 @@ SymTable[NAMESPACE].Value = "" SymTable[NAMESPACE].LegalVals.append("") + # Make sure that initial namespace is also present in LegalVals + else: + + initialns = SymTable[NAMESPACE].Value + + if initialns not in SymTable[NAMESPACE].LegalVals: + SymTable[NAMESPACE].LegalVals.append(initialns) + # Report namespace to debug output if DEBUG: