Package cssutils :: Module util |
[hide private]
[frames] | no frames]

# Module util

source code

base classes and helper functions for css and stylesheets packages

Version: $Id: util.py 1345 2008-07-09 20:51:59Z cthedot $

Classes | [hide private]
| Base Base class for most CSS and StyleSheets classes
| Base2 Base class for new seq handling, used by Selector for now only
| Seq property seq of Base2 inheriting classes, holds a list of Item objects.
| Item an item in the seq list of classes (successor to tuple items in old seq)
| ListSeq (EXPERIMENTAL) A base class used for list classes like css.SelectorList or stylesheets.MediaList
| _Namespaces A dictionary like wrapper for @namespace rules used in a CSSStyleSheet.
| _SimpleNamespaces namespaces used in objects like Selector as long as they are not connected to a CSSStyleSheet

Functions | [hide private]
_defaultFetcher(url) Retrieve data from `url`. | source code
_readUrl(url, fetcher=None, overrideEncoding=None, parentEncoding=None) Read cssText from url and decode it using all relevant methods (HTTP header, BOM, @charset). | source code

Imports: codecs, ifilter, re, types, urllib2, xml, cssutils, Tokenizer, encutils

Function Details | [hide private]

### _defaultFetcher(url) | source code
Retrieve data from `url`. cssutils default implementation of fetch URL function. Returns `(encoding, string)` or `None`

### _readUrl(url, fetcher=None, overrideEncoding=None, parentEncoding=None) | source code
Read cssText from url and decode it using all relevant methods (HTTP header, BOM, @charset). Returns encoding (which is needed to set encoding of stylesheet properly) and decoded text `fetcher` see cssutils.registerFetchUrl for details `overrideEncoding` If given this encoding is used and all other encoding information is ignored (HTTP, BOM etc) `parentEncoding` Encoding of parent stylesheet (while e.g. reading @import references sheets) or document if available. # Priority or encoding information cssutils only: overrideEncoding An HTTP "charset" parameter in a "Content-Type" field (or similar parameters in other protocols) BOM and/or @charset (see below) <link charset=""> or other metadata from the linking mechanism (if any) charset of referring style sheet or document (if any) Assume UTF-8