[reportlab-users] StyleSheet1 and has_key
Roberto Alsina
ralsina at netmanagers.com.ar
Mon Jun 7 21:32:34 EDT 2010
Hi, I have recently tested rst2pdf with reportlab from SVN and only found one
problem: the StyleSheet1 class.
Here's what the old code looked like:
--------
self.StyleSheet = StyleSheet1()
# Much later...
if self.StyleSheet.has_key(key):
return self.StyleSheet[key]
--------
In SVN, StyleSheet1 has no has_key, and I get the right result using
if key in self.StyleSheet:
The bad part is, using "in" doesn't work with RL 2.4, and using "has_key"
doesn't work with RL from SVN.
I am now using this hack:
self.StyleSheet = StyleSheet1()
if not hasattr(self.StyleSheet, 'has_key'):
self.StyleSheet.__class__.has_key = lambda s, k : k in s
but I want to cry every time I see that code. Is there any chance of a working
StyleSheet1.has_key before next release?
Thanks in advance!
More information about the reportlab-users
mailing list