/usr/share/doc/python-cssutils/examples/styledeclaration.py is in python-cssutils 0.9.10-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import cssutils
def show(style):
print "style.length ==", style.length
print "style.item(0) ==", style.item(0)
print "style.item(1) ==", style.item(1)
print "style.getProperties('color', all=True) == ["
for x in style.getProperties('color', all=True):
print "\t", x.cssText
print "\t]"
print "style.getPropertyValue('color') ==", style.getPropertyValue('color'), '\n'
styledeclaration = '''
x:1;
color: yellow;
color: red;
c\olor: green !important;
c\olor: blue;
FONT-FAMILY: serif;
'''
print "\nGiven styledeclaration:"
print styledeclaration
print "------------"
print "setting cssText"
style = cssutils.css.CSSStyleDeclaration(cssText=styledeclaration)
show(style)
print "------------"
# overwrite in any case
print "style.setProperty('color', 'yellow','!important')"
style.setProperty('color', 'yellow','!important')
show(style)
# overwrite in any case, even !important
print "style.setProperty('color', 'red')"
style.setProperty('color', 'red')
show(style)
print "------------"
# overwrite in any case, even !important
print "style.setProperty('color', 'green', '!important')"
style.setProperty('color', 'green', '!important')
show(style)
# overwrite in any case, even !important
print "style.setProperty('color', 'blue')"
style.setProperty('color', 'blue')
show(style)
|