diff options
| author | Matt Deacalion Stevens <matt@dirtymonkey.co.uk> | 2013-07-17 20:20:20 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-07-19 10:38:34 -0400 |
| commit | a269ea4fe0a9a7195f1bd8bf5d462f48c226d525 (patch) | |
| tree | 530f23d3577e988407c3a46100ede866a9cb3cbc /docs | |
| parent | e1c737b62fed5b77cb22c2abe01c304bf5aef6f7 (diff) | |
Fixed #14656 -- Added Atom1Feed `published` element
Some feed aggregators make use of the `published` element as well as
the `updated` element (within the Atom standard -- http://bit.ly/2YySb).
The standard allows for these two elements to be present in the same
entry. `Atom1Feed` had implemented the `updated` element which was
incorrectly taking the date from `pubdate`.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/syndication.txt | 24 | ||||
| -rw-r--r-- | docs/ref/utils.txt | 15 | ||||
| -rw-r--r-- | docs/releases/1.7.txt | 5 |
3 files changed, 39 insertions, 5 deletions
diff --git a/docs/ref/contrib/syndication.txt b/docs/ref/contrib/syndication.txt index 80a7afb35f..9a0fb5830e 100644 --- a/docs/ref/contrib/syndication.txt +++ b/docs/ref/contrib/syndication.txt @@ -815,6 +815,24 @@ This example illustrates all possible attributes and methods for a item_pubdate = datetime.datetime(2005, 5, 3) # Hard-coded pubdate. + # ITEM UPDATED -- It's optional to use one of these three. This is a + # hook that specifies how to get the updateddate for a given item. + # In each case, the method/attribute should return a Python + # datetime.datetime object. + + def item_updateddate(self, item): + """ + Takes an item, as returned by items(), and returns the item's + updateddate. + """ + + def item_updateddate(self): + """ + Returns the updateddated for every item in the feed. + """ + + item_updateddate = datetime.datetime(2005, 5, 3) # Hard-coded updateddate. + # ITEM CATEGORIES -- It's optional to use one of these three. This is # a hook that specifies how to get the list of categories for a given # item. In each case, the method/attribute should return an iterable @@ -928,16 +946,22 @@ They share this interface: * ``categories`` * ``item_copyright`` * ``ttl`` + * ``updateddate`` Extra keyword arguments will be stored for `custom feed generators`_. All parameters, if given, should be Unicode objects, except: * ``pubdate`` should be a Python :class:`~datetime.datetime` object. + * ``updateddate`` should be a Python :class:`~datetime.datetime` object. * ``enclosure`` should be an instance of :class:`django.utils.feedgenerator.Enclosure`. * ``categories`` should be a sequence of Unicode objects. + .. versionadded:: 1.7 + + The optional ``updateddate`` argument was added. + :meth:`.SyndicationFeed.write` Outputs the feed in the given encoding to outfile, which is a file-like object. diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 8e8cf14d6c..6b614e0c83 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -342,11 +342,15 @@ SyndicationFeed All parameters should be Unicode objects, except ``categories``, which should be a sequence of Unicode objects. - .. method:: add_item(title, link, description, [author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None, **kwargs]) + .. method:: add_item(title, link, description, [author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None, updateddate=None, **kwargs]) Adds an item to the feed. All args are expected to be Python ``unicode`` - objects except ``pubdate``, which is a ``datetime.datetime`` object, and - ``enclosure``, which is an instance of the ``Enclosure`` class. + objects except ``pubdate`` and ``updateddate``, which are ``datetime.datetime`` + objects, and ``enclosure``, which is an instance of the ``Enclosure`` class. + + .. versionadded:: 1.7 + + The optional ``updateddate`` argument was added. .. method:: num_items() @@ -380,8 +384,9 @@ SyndicationFeed .. method:: latest_post_date() - Returns the latest item's ``pubdate``. If none of them have a - ``pubdate``, this returns the current date/time. + Returns the latest ``pubdate`` or ``updateddate`` for all items in the + feed. If no items have either of these attributes this returns the + current date/time. Enclosure --------- diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index f551828455..8c5a0fb585 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -67,6 +67,11 @@ Minor features parameters that are passed to the ``dict`` constructor used to build the new context level. +* The :class:`~django.utils.feedgenerator.Atom1Feed` syndication feed's + ``updated`` element now utilizes `updateddate` instead of ``pubdate``, + allowing the ``published`` element to be included in the feed (which + relies on ``pubdate``). + Backwards incompatible changes in 1.7 ===================================== |
