Ticket #6039: atom-feed.diff

File atom-feed.diff, 1.2 KB (added by arien, 13 years ago)

patch against r8972

  • docs/ref/contrib/syndication.txt

     
    912912
    913913For example, to create an Atom 1.0 feed and print it to standard output::
    914914
     915    >>> from datetime import datetime
    915916    >>> from django.utils import feedgenerator
     917    >>>
    916918    >>> f = feedgenerator.Atom1Feed(
    917919    ...     title=u"My Weblog",
    918920    ...     link=u"http://www.example.com/",
    919921    ...     description=u"In which I write about what I ate today.",
    920     ...     language=u"en")
     922    ...     language=u"en",
     923    ...     author_name=u"Myself",
     924    ...     feed_url=u"http://www.example.com/atom.xml")
    921925    >>> f.add_item(title=u"Hot dog today",
    922926    ...     link=u"http://www.example.com/entries/1/",
     927    ...     pubdate=datetime.now(),
    923928    ...     description=u"<p>Today I had a Vienna Beef hot dog. It was pink, plump and perfect.</p>")
    924     >>> print f.writeString('utf8')
    925     <?xml version="1.0" encoding="utf8"?>
     929    >>> print f.writeString('utf-8')
     930    <?xml version="1.0" encoding="utf-8"?>
    926931    <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    927932    ...
    928933    </feed>
Back to Top