`Index </index.txt>`_

=================
version migration
=================
:version: $Id: migrate.txt 1142 2008-03-15 18:57:06Z cthedot $

.. contents::


0.9.5 incompatible changes
==========================
cssutils 0.9.5 introduced some minor incompatible API changes. Reason for most changes is that for most cases the new default behaviour makes more sense.


iterating over ``CSSStyleDeclaration``
--------------------------------------
Iterating over ``css.CSSStyleDelcaration`` now yields *effective* properties only and not *all* properties set in the declaration. To retrieve *all* properties use ``CSSStyleDeclaration.getProperties(all=True)``.

example
~~~~~~~
iterating over a CSSStyleDeclaration with ``cssText='color: red; c\olor: green'``

NEW since 0.9.5:
    yields one Property only which has the value ``green``.
OLD until 0.9.5:
    yielded two Property with the values ``red`` and ``green``.


``Property.name`` attribute
---------------------------
``Property.name`` until now hold the *literal* value (e.g. ``c\olor`` of a properties name. Now it holds the *normalized* name. ``Property.normalname`` is therefor deprecated. To access the unnormalized (literal) name use the new readonly property ``Property.literalname``.

example
~~~~~~~

NEW since 0.9.5
    ::

        p = Property(ur'c\olor', 'red')
        p.name == ur'color'
        p.literalname = ur'c\olor'
        # DEPRECATED: p.normalname == ur'color'

OLD until 0.9.5
    ::

        p = Property(ur'c\olor', 'red')
        p.name == ur'c\olor'
        p.normalname == ur'color'

``Property.priority`` attribute
-------------------------------
The value of ``Property.priority`` (or ``CSSStyleDeclatation.getPropertyPriority(p)``) is now ``important`` without a leading ``!`` as defined in the CSS specs.

(``Property._normalpriority`` has been removed, the normalized value that was available here is now in ``Property.priority``. The literal priority value is available in ``Property.literalproperty`` now (analog to ``Property.literalname``). All these values probably should not be used by client code anyway but may be helpful when using CSS hacks.)

NEW since 0.9.5
    ::

        p = Property(ur'color', 'red', '!IMPOR\\TANT')
        p.priority == u'important'
        p.literalname = u'IMPOR\\TANT'

OLD until 0.9.5
    ::

        p = Property(ur'color', 'red', '!IMPOR\\TANT')
        p.priority == u'!IMPOR\\TANT'
        p._normalpriority = u'!important'

``CSSStyleSheet.replaceUrls(replacer)``
---------------------------------------
Since 0.9.5b1 ``replaceUrls`` has been moved from a method of ``CSSStyleSheet`` to a utility function in cssutils directly.

Example::

        def replacer(url):
            "returns new URL"

        sheet = cssutils.parse(url)


New since 0.9.5b1
    ::

        cssutils.replaceUrls(sheet, replacer)

OLD until 0.9.5a4
    ::

        sheet.replaceUrls(replacer)