[reportlab-users] NameError: global name 'get_stylesheets' is not defined
Hassan Chahrour
hassan at reportlab.com
Wed Feb 13 12:27:38 EST 2008
Hello
If you are calling a class method you should call it as
self.get_stylesheets()['Normal']
On 13/02/2008, Brandon Rich <brich at caseta.com> wrote:
> Can anyone help me out as to why im getting this error?
>
> Thanks in advance
>
>
> class createPDF():
>
> def get_stylesheets(self):
>
> sheets = styles.getSampleStyleSheet()
> sheets['Normal'].fontSize = STYLESHEET_FONT_SIZE
> sheets['Normal'].leading = STYLESHEET_LEADING
> sheets['Normal'].spaceAfter = STYLESHEET_SPACE_AFTER
> return(sheets)
>
> def create_letter(output_file, template_data):
>
> paragraphStyle = get_stylesheets()['Normal']
> xmlHandler = createPDFContent(paragraphStyle)
> xmlData = StringIO(template_data)
> parse(xmlData, xmlHandler)
> pdfDoc = initializePDF()
> doc = pdfDoc.createDoc(output_file, xmlHandler.content)
> return (doc)
>
> File "C:\workspace\pythonlibs\tests\document\CreateViolationPDF.py",
> line 15, in <module>
> class createViolationPDF():
> File "C:\workspace\pythonlibs\tests\document\CreateViolationPDF.py",
> line 53, in createViolationPDF
> create_letter(letters_file, t)
> File "C:\workspace\pythonlibs\tests\document\CreateViolationPDF.py",
> line 38, in create_letter
> paragraphStyle = get_stylesheets()['Normal']
> NameError: global name 'get_stylesheets' is not defined
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>
--
Regards
Hassan Chahrour
More information about the reportlab-users
mailing list