Fixed bug wherein templates were not properly being identified within namespaces.
1 parent 95972b8 commit 2b5a709cc878bf420104783cb4559397b8ec5d62
@tundra tundra authored on 19 Jan 2005
Showing 1 changed file
View
27
tconfpy.py
 
# Program Information
 
PROGNAME = "tconfpy"
RCSID = "$Id: tconfpy.py,v 2.105 2005/01/17 22:27:21 tundra Exp $"
RCSID = "$Id: tconfpy.py,v 2.106 2005/01/19 10:03:33 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
#----------------------------------------------------------#
# Imports #
#----------------------------------------------------------#
 
import copy
import os
import platform
import re
from sys import platform as sysplat
# Get left and right sides of the assignment
e = line.index(EQUAL)
l = line[:e].strip()
r = line[e+1:].strip()
templatename = l.split(NSSEP)[-1]
 
 
# Make sure symbol name is properly formed
 
if not ValidateSymbolName(l, cfgfile, linenum):
# 2) If var has no template, but TemplatesOnly=True -> Error
# 3) If var has no template, and TemplatesOnly=False -> Create new var
 
# Rule 1
if varname in SymTable.Templates.Symbols:
 
 
if templatename in SymTable.Templates.Symbols:
# Create the new variable
SymTable.Symbols[l] = SymTable.Templates.Symbols[varname]
 
# If the RHS is blank, use the default value from the template
if not r:
r = SymTable.Templates.Symbols[varname].Default
 
SymTable.Symbols[l] = copy.copy(SymTable.Templates.Symbols[templatename])
 
# Load the proposed value only if valid
 
if ValidateValue(l, r, cfgfile, linenum):
SymTable.Symbols[l].Value = r