Skip to content

Commit

Permalink
Edited docs/syndication_feeds.txt changes from [6741]
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6873 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Dec 4, 2007
1 parent 72a5c03 commit 3c65462
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/syndication_feeds.txt
Expand Up @@ -234,6 +234,7 @@ request to the URL ``/rss/beats/0613/``:
``get_object()`` method, passing it the bits. In this case, bits is ``get_object()`` method, passing it the bits. In this case, bits is
``['0613']``. For a request to ``/rss/beats/0613/foo/bar/``, bits would ``['0613']``. For a request to ``/rss/beats/0613/foo/bar/``, bits would
be ``['0613', 'foo', 'bar']``. be ``['0613', 'foo', 'bar']``.

* ``get_object()`` is responsible for retrieving the given beat, from the * ``get_object()`` is responsible for retrieving the given beat, from the
given ``bits``. In this case, it uses the Django database API to retrieve given ``bits``. In this case, it uses the Django database API to retrieve
the beat. Note that ``get_object()`` should raise the beat. Note that ``get_object()`` should raise
Expand All @@ -243,6 +244,7 @@ request to the URL ``/rss/beats/0613/``:
raises ``Beat.DoesNotExist`` on failure, and ``Beat.DoesNotExist`` is a raises ``Beat.DoesNotExist`` on failure, and ``Beat.DoesNotExist`` is a
subclass of ``ObjectDoesNotExist``. Raising ``ObjectDoesNotExist`` in subclass of ``ObjectDoesNotExist``. Raising ``ObjectDoesNotExist`` in
``get_object()`` tells Django to produce a 404 error for that request. ``get_object()`` tells Django to produce a 404 error for that request.

* To generate the feed's ``<title>``, ``<link>`` and ``<description>``, * To generate the feed's ``<title>``, ``<link>`` and ``<description>``,
Django uses the ``title()``, ``link()`` and ``description()`` methods. In Django uses the ``title()``, ``link()`` and ``description()`` methods. In
the previous example, they were simple string class attributes, but this the previous example, they were simple string class attributes, but this
Expand All @@ -258,9 +260,9 @@ request to the URL ``/rss/beats/0613/``:
Inside the ``link()`` method, we handle the possibility that ``obj`` Inside the ``link()`` method, we handle the possibility that ``obj``
might be ``None``, which can occur when the URL isn't fully specified. In might be ``None``, which can occur when the URL isn't fully specified. In
some cases, you might want to do something else in this case, which would some cases, you might want to do something else in this case, which would
mean you'd need to check for ``obj`` existing in other methods as well mean you'd need to check for ``obj`` existing in other methods as well.
(the ``link()`` method is called very early in the feed generation (The ``link()`` method is called very early in the feed generation
process, so is a good place to bail out early). process, so it's a good place to bail out early.)


* Finally, note that ``items()`` in this example also takes the ``obj`` * Finally, note that ``items()`` in this example also takes the ``obj``
argument. The algorithm for ``items`` is the same as described in the argument. The algorithm for ``items`` is the same as described in the
Expand Down

0 comments on commit 3c65462

Please sign in to comment.