diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2024-04-26 22:10:40 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-06-18 17:25:43 +0200 |
| commit | 62300b81cf7687d176af3b40aa6101942801292d (patch) | |
| tree | 12190b41d01e55f0799a439a6a690d7c644e0464 /docs/ref/utils.txt | |
| parent | ce1ad98565d98b7939367b2bcab755c3555ceb42 (diff) | |
Fixed #12978 -- Added support for RSS feed stylesheets.
Diffstat (limited to 'docs/ref/utils.txt')
| -rw-r--r-- | docs/ref/utils.txt | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 3e357cba17..9fb1e83e9e 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -331,6 +331,32 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 See https://web.archive.org/web/20110514113830/http://diveintomark.org/archives/2004/05/28/howto-atom-id +``Stylesheet`` +-------------- + +.. versionadded:: 5.2 + +.. class:: Stylesheet(url, mimetype="", media="screen") + + Represents an RSS stylesheet. + + .. attribute:: url + + Required argument. The URL where the stylesheet is located. + + .. attribute:: mimetype + + An optional string containing the MIME type of the stylesheet. If not + specified, Django will attempt to guess it by using Python's + :py:func:`mimetypes.guess_type()`. Use ``mimetype=None`` if you don't + want your stylesheet to have a MIME type specified. + + .. attribute:: media + + An optional string which will be used as the ``media`` attribute of + the stylesheet. Defaults to ``"screen"``. Use ``media=None`` if you + don't want your stylesheet to have a ``media`` attribute. + ``SyndicationFeed`` ------------------- @@ -339,7 +365,7 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 Base class for all syndication feeds. Subclasses should provide ``write()``. - .. method:: __init__(title, link, description, language=None, author_email=None, author_name=None, author_link=None, subtitle=None, categories=None, feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs) + .. method:: __init__(title, link, description, language=None, author_email=None, author_name=None, author_link=None, subtitle=None, categories=None, feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, stylesheets=None, **kwargs) Initialize the feed with the given dictionary of metadata, which applies to the entire feed. @@ -347,8 +373,15 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 Any extra keyword arguments you pass to ``__init__`` will be stored in ``self.feed``. - All parameters should be strings, except ``categories``, which should - be a sequence of strings. + All parameters should be strings, except for two: + + * ``categories`` should be a sequence of strings. + * ``stylesheets`` should be a sequence of either strings or + :class:`Stylesheet` instances. + + .. versionchanged:: 5.2 + + The ``stylesheets`` argument was added. .. method:: add_item(title, link, description, author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, categories=(), item_copyright=None, ttl=None, updateddate=None, enclosures=None, **kwargs) @@ -368,6 +401,13 @@ https://web.archive.org/web/20110718035220/http://diveintomark.org/archives/2004 Add elements in the root (i.e. feed/channel) element. Called from ``write()``. + .. method:: add_stylesheets(self, handler) + + .. versionadded:: 5.2 + + Add stylesheet information to the document. + Called from ``write()``. + .. method:: item_attributes(item) Return extra attributes to place on each item (i.e. item/entry) |
