Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More small tweaks to docs/syndication_feeds.txt

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 91f1b087598777563f0b99d060f121d802eeacb1 1 parent 782edb3
Adrian Holovaty authored November 12, 2005

Showing 1 changed file with 17 additions and 15 deletions. Show diff stats Hide diff stats

  1. 32  docs/syndication_feeds.txt
32  docs/syndication_feeds.txt
@@ -89,7 +89,7 @@ can live anywhere in your codebase.
89 89
 A simple example
90 90
 ----------------
91 91
 
92  
-This simple example, taken from chicagocrime.org, describes a feed of the
  92
+This simple example, taken from `chicagocrime.org`_, describes a feed of the
93 93
 latest five news items::
94 94
 
95 95
     from django.contrib.syndication.feeds import Feed
@@ -132,8 +132,8 @@ put into those elements.
132 132
             ``{{ site.domain }}`` or ``{{ site.name }}``.
133 133
 
134 134
       If you don't create a template for either the title or description, the
135  
-      framework will use the template ``{{ obj }}`` by default -- that is, the
136  
-      normal string representation of the object.
  135
+      framework will use the template ``"{{ obj }}"`` by default -- that is,
  136
+      the normal string representation of the object.
137 137
     * To specify the contents of ``<link>``, you have two options. For each
138 138
       item in ``items()``, Django first tries executing a
139 139
       ``get_absolute_url()`` method on that object. If that method doesn't
@@ -142,6 +142,7 @@ put into those elements.
142 142
       Both ``get_absolute_url()`` and ``item_link()`` should return the item's
143 143
       URL as a normal Python string.
144 144
 
  145
+.. _chicagocrime.org: http://www.chicagocrime.org/
145 146
 .. _object-relational mapper: http://www.djangoproject.com/documentation/db_api/
146 147
 .. _Django templates: http://www.djangoproject.com/documentation/templates/
147 148
 
@@ -150,18 +151,18 @@ A complex example
150 151
 
151 152
 The framework also supports more complex feeds, via parameters.
152 153
 
153  
-For example, chicagocrime.org offers an RSS feed of recent crimes for every
  154
+For example, `chicagocrime.org`_ offers an RSS feed of recent crimes for every
154 155
 police beat in Chicago. It'd be silly to create a separate ``Feed`` class for
155 156
 each police beat; that would violate the `DRY principle`_ and would couple data
156  
-to programming logic. Instead, the RSS framework lets you make generic feeds
157  
-that output items based on information in the feed's URL.
  157
+to programming logic. Instead, the syndication framework lets you make generic
  158
+feeds that output items based on information in the feed's URL.
158 159
 
159 160
 On chicagocrime.org, the police-beat feeds are accessible via URLs like this:
160 161
 
161 162
     * ``/rss/beats/0613/`` -- Returns recent crimes for beat 0613.
162 163
     * ``/rss/beats/1424/`` -- Returns recent crimes for beat 1424.
163 164
 
164  
-The slug here is ``beats``. The syndication framework sees the extra URL bits
  165
+The slug here is ``"beats"``. The syndication framework sees the extra URL bits
165 166
 after the slug -- ``0613`` and ``1424`` -- and gives you a hook to tell it what
166 167
 those URL bits mean, and how they should influence which items get published in
167 168
 the feed.
@@ -207,8 +208,8 @@ request to the URL ``/rss/beats/0613/``:
207 208
       subclass of ``ObjectDoesNotExist``. Raising ``ObjectDoesNotExist`` in
208 209
       ``get_object()`` tells Django to produce a 404 error for that request.
209 210
     * To generate the feed's ``<title>``, ``<link>`` and ``<description>``,
210  
-      Django uses the ``title``, ``link`` and ``description`` methods. In the
211  
-      previous example, they were simple string class attributes, but this
  211
+      Django uses the ``title()``, ``link()`` and ``description()`` methods. In
  212
+      the previous example, they were simple string class attributes, but this
212 213
       example illustrates that they can be either strings *or* methods. For
213 214
       each of ``title``, ``link`` and ``description``, Django follows this
214 215
       algorithm:
@@ -242,7 +243,7 @@ To change that, add a ``feed_type`` attribute to your ``Feed`` class, like so::
242 243
 
243 244
 Note that you set ``feed_type`` to a class object, not an instance.
244 245
 
245  
-Currently available feed types are::
  246
+Currently available feed types are:
246 247
 
247 248
     * ``django.utils.feedgenerator.Rss201rev2Feed`` (RSS 2.01. Default.)
248 249
     * ``django.utils.feedgenerator.RssUserland091Feed`` (RSS 0.91.)
@@ -499,8 +500,8 @@ several subclasses:
499 500
 Each of these three classes knows how to render a certain type of feed as XML.
500 501
 They share this interface:
501 502
 
502  
-``__init__(title, link, description, language=None, author_email=None,
503  
-author_name=None, author_link=None, subtitle=None, categories=None)``
  503
+``__init__(title, link, description, language=None, author_email=None,``
  504
+``author_name=None, author_link=None, subtitle=None, categories=None)``
504 505
 
505 506
 Initializes the feed with the given metadata, which applies to the entire feed
506 507
 (i.e., not just to a specific item in the feed).
@@ -508,13 +509,13 @@ Initializes the feed with the given metadata, which applies to the entire feed
508 509
 All parameters, if given, should be Unicode objects, except ``categories``,
509 510
 which should be a sequence of Unicode objects.
510 511
 
511  
-``add_item(title, link, description, author_email=None, author_name=None,
512  
-pubdate=None, comments=None, unique_id=None, enclosure=None, categories=())``
  512
+``add_item(title, link, description, author_email=None, author_name=None,``
  513
+``pubdate=None, comments=None, unique_id=None, enclosure=None, categories=())``
513 514
 
514 515
 Add an item to the feed with the given parameters. All parameters, if given,
515 516
 should be Unicode objects, except:
516 517
 
517  
-    * ``pubdate`` should be a Python datetime object.
  518
+    * ``pubdate`` should be a `Python datetime object`_.
518 519
     * ``enclosure`` should be an instance of ``feedgenerator.Enclosure``.
519 520
     * ``categories`` should be a sequence of Unicode objects.
520 521
 
@@ -550,3 +551,4 @@ This example creates an Atom 1.0 feed and prints it to standard output::
550 551
     </entry></feed>
551 552
 
552 553
 .. _django/utils/feedgenerator.py: http://code.djangoproject.com/browser/django/trunk/django/utils/feedgenerator.py
  554
+.. _Python datetime object: http://www.python.org/doc/current/lib/module-datetime.html

0 notes on commit 91f1b08

Please sign in to comment.
Something went wrong with that request. Please try again.