[reportlab-users] Is this a bug?

Roberto Alsina ralsina at netmanagers.com.ar
Tue Sep 9 19:53:31 EDT 2008


This is using reportlabs 2.1

I had a bug report from a user, and after a little work, I have distilled it
to this:

# -*- coding: utf-8 -*-
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
styles = getSampleStyleSheet()
def go():
doc = SimpleDocTemplate("phello.pdf")
Story = [Spacer(1,2*inch)]
style = styles["Normal"]
p = Paragraph('''
<a href="http://www.com/form?a1=x&a2=y"> Citizen</a>
''', style)
Story.append(p)
doc.build(Story)

go()

When I run it, I get the following error:

xml parser error (; missing after entity/char reference) in paragraph
beginning

If the paragraph contains

<a href="http://www.com/form?a1=xa2=y" > Citizen</a>

it works just fine. It just doesn't like ampersands there.

It also works if I put

<a href="http://www.com/form?a1=x&amp;a2=y" > Citizen</a>

and links to the right place, am I not getting something about quoting here?

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it. --Brian W. Kernighan


More information about the reportlab-users mailing list