ANN: cssutils 0.9.5rc1

Christof Hoeke csad7 at
Wed Jul 9 15:40:23 CEST 2008

what is it
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer  though!)

As there have been quite a few bugfixes and also some minor changes this 
is a release candidate and not the final release yet.

main changes
0.9.5rc1 080709
     - **API CHANGE/FEATURE**: ``The cssutils.log`` may be partly used 
like a standard logging log. The following methods are available: 
('setLevel', 'getEffectiveLevel', 'addHandler', 'removeHandler') as well 
as all "messaging" calls like 'error', 'warning' etc.

       Therefor ``cssutils.log.setloglevel`` has been *DEPRECATED* and 
should be used via ``cssutils.log.setLevel``. The old method is still 
available though.

       ``cssutils.log.setlog`` has been renamed to 
``cssutils.log.setLog`` but is still available but *DEPRECATED* too.

     - **FEATURE**: All three decoders in the codec now have an 
additional ``force`` argument. If ``force`` is false, the encoding from 
the input will only by used if is is detected explicitely via BOM or 
@charset rule.

     - **FEATURE**: ``cssparse`` script has new option ``-m --minify`` 
which results in the parsed CSS to be serialized minified

     - **FEATURE**: ``CSSCapture`` and ``csscombine`` are now available 
not only as standalone scripts but also via 
``cssutils.script.CSSCapture`` and ``cssutils.script.csscombine`` 
repectively so you can use them programmatically now.

     - **BUGFIX**: A space after @rule keyword is added when serializing 
minified something like ``@media all{}``. Until now it was 
``@mediaall{}`` which is recognized by Safari only and may not be valid 
at all.

     - **BUGFIX**: Properties of rules set via ``css.CSSStyleSheet.add`` 
or ``.insert`` were not set properly, e.g. ``parentStyleSheet`` or the 
stylesheet handling of new @import rules was buggy.

     - BUGFIX: Encountering OSError during resolving @import does not 
throw an error anymore but the resulting CSSImportRule.styleSheet will 
have a value of ``None``. OSError will probably only happen when using 

     - **BUGFIX/IMPROVEMENT**: A style sheet with ``href == None`` (e.g. 
parsed with ``parseString()`` or build completely from scratch) uses 
``os.getcwd()`` as its base href now to be able to resolve CSSImportRules.

     - **BUGFIX/IMPROVEMENT**: Rewrote ``csscombine`` script which 
should be much more stable now and handles namespaces correctly. Nested 
imports are still not resolved yet but this may come in the next release.

     - BUGFIX/IMPROVEMENT: Added catching of WindowsError to default 
fetcher (e.g. is a file URL references a file not present).

     - **BUGFIX/CHANGE**: Redone ``csscapture`` script. A few minor 
method changes (parameter ``ua`` of ``capture`` has been replaced by 
init parameter) and lots of internal improvement has been done.

     - CHANGE: ``CSSStyleSheet.add(rule)`` simply appends rules with no 
specific order in the sheet to the end of it. So e.g. COMMENTs, 
STYLE_RULEs, etc are appended while rules with a specific place are 
ordered-in as before (e.g. IMPORT_RULE or NAMESPACE_RULE). Until now 
rules of a specific type like COMMENTs were ordered together which does 
not really make sense. The ``csscombine`` script needs this 
functionality and the resulting combined sheets should be more readable 
and understandable now.

     - CHANGE: Default URL fetcher emits an ERROR instead of a warning 
if finding a different mine-type than ``text/css``.
     - a few other changes, bugfixes  and improvements

     CSSValue, CSSValueList, and CSSPrimitiveValue and the relevant 
methods/properties Property.cssValue and 
CSSStyleDeclaration.getPropertyCSSValue are more or less DEPRECATED and 
will probably be replaced with interfaces defined in CSSOM. For now use 
the properties and methods that handle values as simple strings, e.g. 
``Property.value``. As the aforementioned classes are not hardly that 
useful anyway this should not be a big problem but please beware if you 
use or have used them.

     If you think this a bad idea please let me know!

cssutils is published under the LGPL version 3 or later, see

If you have other licensing needs please let me know.

For download options see

cssutils needs Python 2.4 or higher (tested with Python 2.5.2 on Vista only)

Bug reports (via Google code), comments, etc are very much appreciated! 


More information about the Python-announce-list mailing list