Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #10141 -- Added a missing import to the complex Feed ex…

…ample. Thanks to Temoto for the report.

Merge of r9858 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8519146963fadd2317bf81fface6e2620395673c 1 parent 429b57d
Russell Keith-Magee authored February 22, 2009

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

  1. 33  docs/ref/contrib/syndication.txt
33  docs/ref/contrib/syndication.txt
@@ -143,7 +143,7 @@ into those elements.
143 143
 
144 144
          * ``{{ obj }}`` -- The current object (one of whichever objects you
145 145
            returned in :meth:`items()`).
146  
-         
  146
+
147 147
          * ``{{ site }}`` -- A :class:`django.contrib.sites.models.Site` object
148 148
            representing the current site. This is useful for ``{{ site.domain
149 149
            }}`` or ``{{ site.name }}``. If you do *not* have the Django sites
@@ -181,9 +181,9 @@ into those elements.
181 181
             {{ obj.title }}
182 182
 
183 183
       * latest_description.html:
184  
-      
  184
+
185 185
         .. code-block:: html+django
186  
-      
  186
+
187 187
             {{ obj.description }}
188 188
 
189 189
 .. _chicagocrime.org: http://www.chicagocrime.org/
@@ -213,6 +213,7 @@ the feed.
213 213
 An example makes this clear. Here's the code for these beat-specific feeds::
214 214
 
215 215
     from django.contrib.syndication.feeds import FeedDoesNotExist
  216
+    from django.core.exceptions import ObjectDoesNotExist
216 217
 
217 218
     class BeatFeed(Feed):
218 219
         def get_object(self, bits):
@@ -278,9 +279,9 @@ request to the URL :file:`/rss/beats/0613/`:
278 279
 
279 280
         * First, it tries to call a method, passing the ``obj`` argument, where
280 281
           ``obj`` is the object returned by :meth:`get_object()`.
281  
-        
  282
+
282 283
         * Failing that, it tries to call a method with no arguments.
283  
-        
  284
+
284 285
         * Failing that, it uses the class attribute.
285 286
 
286 287
       Inside the :meth:`link()` method, we handle the possibility that ``obj``
@@ -840,11 +841,11 @@ They share this interface:
840 841
 
841 842
     Initialize the feed with the given dictionary of metadata, which applies to
842 843
     the entire feed. Required keyword arguments are:
843  
-    
  844
+
844 845
         * ``title``
845 846
         * ``link``
846 847
         * ``description``
847  
-    
  848
+
848 849
     There's also a bunch of other optional keywords:
849 850
 
850 851
         * ``language``
@@ -857,7 +858,7 @@ They share this interface:
857 858
         * ``feed_copyright``
858 859
         * ``feed_guid``
859 860
         * ``ttl``
860  
-    
  861
+
861 862
     Any extra keyword arguments you pass to ``__init__`` will be stored in
862 863
     ``self.feed`` for use with `custom feed generators`_.
863 864
 
@@ -866,7 +867,7 @@ They share this interface:
866 867
 
867 868
 .. method:: SyndicationFeed.add_item(**kwargs)
868 869
 
869  
-    Add an item to the feed with the given parameters. 
  870
+    Add an item to the feed with the given parameters.
870 871
 
871 872
     Required keyword arguments are:
872 873
 
@@ -893,7 +894,7 @@ They share this interface:
893 894
 
894 895
         * ``pubdate`` should be a `Python datetime object`_.
895 896
         * ``enclosure`` should be an instance of ``feedgenerator.Enclosure``.
896  
-        * ``categories`` should be a sequence of Unicode objects.    
  897
+        * ``categories`` should be a sequence of Unicode objects.
897 898
 
898 899
 .. method:: SyndicationFeed.write(outfile, encoding)
899 900
 
@@ -927,7 +928,7 @@ Custom feed generators
927 928
 ----------------------
928 929
 
929 930
 If you need to produce a custom feed format, you've got a couple of options.
930  
-    
  931
+
931 932
 If the feed format is totally custom, you'll want to subclass
932 933
 ``SyndicationFeed`` and completely replace the ``write()`` and
933 934
 ``writeString()`` methods.
@@ -938,25 +939,25 @@ feeds typically add extra elements and/or attributes to the underlying format,
938 939
 and there are a set of methods that ``SyndicationFeed`` calls to get these extra
939 940
 attributes. Thus, you can subclass the appropriate feed generator class
940 941
 (``Atom1Feed`` or ``Rss201rev2Feed``) and extend these callbacks. They are:
941  
-      
  942
+
942 943
 .. _georss: http://georss.org/
943 944
 .. _itunes podcast format: http://www.apple.com/itunes/store/podcaststechspecs.html
944 945
 
945 946
 ``SyndicationFeed.root_attributes(self, )``
946 947
     Return a ``dict`` of attributes to add to the root feed element
947 948
     (``feed``/``channel``).
948  
-    
  949
+
949 950
 ``SyndicationFeed.add_root_elements(self, handler)``
950 951
     Callback to add elements inside the root feed element
951 952
     (``feed``/``channel``). ``handler`` is an `XMLGenerator`_ from Python's
952 953
     built-in SAX library; you'll call methods on it to add to the XML
953 954
     document in process.
954  
-    
  955
+
955 956
 ``SyndicationFeed.item_attributes(self, item)``
956 957
     Return a ``dict`` of attributes to add to each item (``item``/``entry``)
957 958
     element. The argument, ``item``, is a dictionary of all the data passed to
958 959
     ``SyndicationFeed.add_item()``.
959  
-    
  960
+
960 961
 ``SyndicationFeed.add_item_elements(self, handler, item)``
961 962
     Callback to add elements to each item (``item``/``entry``) element.
962 963
     ``handler`` and ``item`` are as above.
@@ -973,7 +974,7 @@ For example, you might start implementing an iTunes RSS feed generator like so::
973 974
             attrs = super(iTunesFeed, self).root_attributes()
974 975
             attrs['xmlns:itunes'] = 'http://www.itunes.com/dtds/podcast-1.0.dtd'
975 976
             return attrs
976  
-            
  977
+
977 978
         def add_root_elements(self, handler):
978 979
             super(iTunesFeed, self).add_root_elements(handler)
979 980
             handler.addQuickElement('itunes:explicit', 'clean')

0 notes on commit 8519146

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