summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cfa661d)
raw | patch | inline | side by side (parent: cfa661d)
author | aurium <aurium@users.sourceforge.net> | |
Fri, 2 Oct 2009 14:42:58 +0000 (14:42 +0000) | ||
committer | aurium <aurium@users.sourceforge.net> | |
Fri, 2 Oct 2009 14:42:58 +0000 (14:42 +0000) |
share/extensions/simplestyle.py | patch | blob | history |
index 4dcfd1aba9761c742859e72067f5c3ddf32d80af..e312d3cefc92645fc6feb29fa204c38ffcb8da62 100755 (executable)
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):