From c0d79bb094e8586129a6e0ae2fb0cd4ab8fde64e Mon Sep 17 00:00:00 2001 From: "Aur??lio A. Heckert" Date: Fri, 2 Oct 2009 14:42:58 +0000 Subject: more friendly usage for simplestyle: no more test for style attribute or type conversion on user code. (bzr r8694) --- share/extensions/simplestyle.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/share/extensions/simplestyle.py b/share/extensions/simplestyle.py index 4dcfd1aba..e312d3cef 100755 --- a/share/extensions/simplestyle.py +++ b/share/extensions/simplestyle.py @@ -173,10 +173,13 @@ svgcolors={ def parseStyle(s): """Create a dictionary from the value of an inline style attribute""" - return dict([i.split(":") for i in s.split(";") if len(i)]) + if s is None: + return {} + else: + return dict([i.split(":") for i in s.split(";") if len(i)]) def formatStyle(a): """Format an inline style attribute from a dictionary""" - return ";".join([":".join(i) for i in a.iteritems()]) + return ";".join([att+":"+str(val) for att,val in a.iteritems()]) def isColor(c): """Determine if its a color we can use. If not, leave it unchanged.""" if c.startswith('#') and (len(c)==4 or len(c)==7): -- cgit v1.2.3