I have a snippet of code such as:

t = templateName.Template(lr = latestReading, ld = lastDayReadings, si = 
stationInfo)
        print t.si
        t.write(os.path.join(gpConfig.get('Main', 'outputDirBase'), 
stationInfo['OutputDir'], station + '.html'))

That 'print t.si' station before the t.write call prints out a dict that 
very clearly contains a key named 'StationDescriptiveName'.  But when 
the template writes, I get this exception:

AttributeError: 'dict' object has no attribute 'StationDescriptiveName'

The HTML looks like:
<title>${si.StationDescriptiveName} - Current Conditions</title>

Is there something I'm missing?  I never did see any examples in the 
docs of passing dicts and arrays, so maybe it's not possible?

BTW, is there any way to get the line numbers in error messages to be 
accurate? The above exception tells me the error occurred at 
templateName.py line 41, and the only occurrences of 
StationDescriptiveName are on lines 4, 13, and 19...nowhere near line 
41. :)  The line numbers are off too when it errors out on mal-formed 
XML.

Pointers appreciated! :)

j

-- 
Joshua J. Kugler -- Fairbanks, Alaska -- ICQ#:13706295
Every knee shall bow, and every tongue confess, in heaven, on earth, and 
under the earth, that Jesus Christ is LORD -- Count on it!

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss

Reply via email to