[reportlab-users] Cheetah

Brandon Rich brich at caseta.com
Tue Feb 5 11:57:24 EST 2008


I'm not sure if this is the right forum for this question, but perhaps
someone has some insight to my question .

Currently I have a cheetah template file that has all hard coded
information that I am passing back to Reportlab and then appending to a
PDF. I also have a python file that is passed back to Reportlab in the
form of a dictionary. Question, once changing the cheetah template
file, to include say a $city, how do I pass the information from the
dictionary? I have looked at several examples online, but none seem to
be working currently. Any help would be great.

Thanks in advance

Brandon

from pdfutil import *
from StringIO import StringIO
from notice_data import *
from Cheetah.Template import Template

notices = getNotices() #returns dictionary
file = open("test.pdf","wb")
letters_file = StringIO()
create_letter(letters_file) #create_letter returns handled XML currently

pdf = letters_file.getvalue()
letters_file.close()
file.write(pdf)
file.close()

Cheetah template file

<doc>
<para>You are from<b>$city</b><br/><br/>

Dictionary
[{'violator': {'city': 'LA', 'zip': '9999', 'suffix': 'Jr'}]


More information about the reportlab-users mailing list