[reportlab-users] NameError: global name 'get_stylesheets'isnot defined
Brandon Rich
brich at caseta.com
Wed Feb 13 13:04:14 EST 2008
I seem to have got it working
Thanks
-----Original Message-----
From: reportlab-users-bounces at reportlab.com
[mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Brandon Rich
Sent: Wednesday, February 13, 2008 11:33 AM
To: Support list for users of Reportlab software
Subject: Re: [reportlab-users] NameError: global name
'get_stylesheets'isnot defined
I still get the error message
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 = self.get_stylesheets()['Normal']
NameError: global name 'self' is not defined
-----Original Message-----
From: reportlab-users-bounces at reportlab.com
[mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Hassan
Chahrour
Sent: Wednesday, February 13, 2008 11:28 AM
To: Support list for users of Reportlab software
Subject: Re: [reportlab-users] NameError: global name 'get_stylesheets'
isnot defined
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
_______________________________________________
reportlab-users mailing list
reportlab-users at reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users
_______________________________________________
reportlab-users mailing list
reportlab-users at reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users
More information about the reportlab-users
mailing list