From: aurium Date: Fri, 2 Oct 2009 14:42:58 +0000 (+0000) Subject: more friendly usage for simplestyle: no more test for style attribute or type convers... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5a67a9766d3c797c359c855a1010603e0bbf6f46;p=inkscape.git more friendly usage for simplestyle: no more test for style attribute or type conversion on user code. --- 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):