Documentation fixes

This commit is contained in:
Lars Kiesow 2013-05-04 20:08:08 +02:00
parent 607bc6b596
commit ce45beb37f
6 changed files with 34 additions and 17 deletions

View file

@ -33,9 +33,9 @@
Note that for the methods which set fields that can occur more than once in Note that for the methods which set fields that can occur more than once in
a feed you can use all of the following ways to provide data: a feed you can use all of the following ways to provide data:
- Provide the data for that element as keyword arguments:: - Provide the data for that element as keyword arguments
- Provide the data for that element as dictionary:: - Provide the data for that element as dictionary
- Provide a list of dictionaries with the data for several elements:: - Provide a list of dictionaries with the data for several elements
Example:: Example::

View file

@ -17,6 +17,9 @@ from feedgenerator.util import ensure_format
class FeedEntry(object): class FeedEntry(object):
'''FeedEntry call representing an ATOM feeds entry node or an RSS feeds item
node.
'''
# ATOM # ATOM
# required # required
@ -323,9 +326,11 @@ class FeedEntry(object):
- a list of dictionaries containing the link fields - a list of dictionaries containing the link fields
A link has the following fields: A link has the following fields:
- *href* is the URI of the referenced resource (typically a Web page) - *href* is the URI of the referenced resource (typically a Web page)
- *rel* contains a single link relationship type. It can be a full URI, - *rel* contains a single link relationship type. It can be a full URI,
or one of the following predefined values (default=alternate): or one of the following predefined values (default=alternate):
- *alternate* an alternate representation of the entry or feed, for - *alternate* an alternate representation of the entry or feed, for
example a permalink to the html version of the entry, or the front example a permalink to the html version of the entry, or the front
page of the weblog. page of the weblog.
@ -335,6 +340,7 @@ class FeedEntry(object):
- *related* an document related to the entry or feed. - *related* an document related to the entry or feed.
- *self* the feed itself. - *self* the feed itself.
- *via* the source of the information provided in the entry. - *via* the source of the information provided in the entry.
- *type* indicates the media type of the resource. - *type* indicates the media type of the resource.
- *hreflang* indicates the language of the referenced resource. - *hreflang* indicates the language of the referenced resource.
- *title* human readable information about the link, typically for - *title* human readable information about the link, typically for

View file

@ -1,12 +1,13 @@
#!/bin/env python #!/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' '''
feedgenerator feedgenerator.feed
~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
:copyright: 2013, Lars Kiesow <lkiesow@uos.de> :copyright: 2013, Lars Kiesow <lkiesow@uos.de>
:license: FreeBSD and LGPL, see license.* for more details. :license: FreeBSD and LGPL, see license.* for more details.
''' '''
from lxml import etree from lxml import etree
@ -18,6 +19,8 @@ from feedgenerator.util import ensure_format
class FeedGenerator(object): class FeedGenerator(object):
'''FeedGenerator for generating ATOM and RSS feeds.
'''
__feed_entries = [] __feed_entries = []
@ -459,9 +462,11 @@ class FeedGenerator(object):
- a list of dictionaries containing the link fields - a list of dictionaries containing the link fields
A link has the following fields: A link has the following fields:
- *href* is the URI of the referenced resource (typically a Web page) - *href* is the URI of the referenced resource (typically a Web page)
- *rel* contains a single link relationship type. It can be a full URI, - *rel* contains a single link relationship type. It can be a full URI,
or one of the following predefined values (default=alternate): or one of the following predefined values (default=alternate):
- *alternate* an alternate representation of the entry or feed, for - *alternate* an alternate representation of the entry or feed, for
example a permalink to the html version of the entry, or the front example a permalink to the html version of the entry, or the front
page of the weblog. page of the weblog.
@ -471,6 +476,7 @@ class FeedGenerator(object):
- *related* an document related to the entry or feed. - *related* an document related to the entry or feed.
- *self* the feed itself. - *self* the feed itself.
- *via* the source of the information provided in the entry. - *via* the source of the information provided in the entry.
- *type* indicates the media type of the resource. - *type* indicates the media type of the resource.
- *hreflang* indicates the language of the referenced resource. - *hreflang* indicates the language of the referenced resource.
- *title* human readable information about the link, typically for - *title* human readable information about the link, typically for
@ -744,7 +750,7 @@ class FeedGenerator(object):
The value should be an IETF language tag. The value should be an IETF language tag.
:param language: Language of the feed. :param language: Language of the feed.
:: Language of the feed. :returns: Language of the feed.
''' '''
if not language is None: if not language is None:
self.__rss_language = language self.__rss_language = language

View file

@ -21,6 +21,8 @@ from feedgenerator.util import ensure_format
class PodcastGenerator(FeedGenerator): class PodcastGenerator(FeedGenerator):
'''FeedGenerator extension for podcasts.
'''
## ITunes tags ## ITunes tags

View file

@ -1,8 +1,8 @@
#!/bin/env python #!/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' '''
feedgenerator.podcast feedgenerator.podcast_entry
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Extends the feedgenerator to produce podcasts. Extends the feedgenerator to produce podcasts.
@ -20,6 +20,8 @@ from feedgenerator.util import ensure_format
class PodcastEntry(FeedEntry): class PodcastEntry(FeedEntry):
'''FeedEntry extension for podcasts.
'''
## ITunes tags ## ITunes tags

View file

@ -1,20 +1,21 @@
============= =============
feedgenerator Feedgenerator
============= =============
This module can be used to generate web feeds in both ATOM and RSS format. This module can be used to generate web feeds in both ATOM and RSS format.
The included PodcastGenerator furthermore includes all of Apples RSS The included PodcastGenerator furthermore includes all of Apples RSS
extension for Podcasts. extension for Podcasts.
- copyright: 2013 by Lars Kiesow It is licensed under the terms of both, the FreeBSD license and the LGPL.
- license: FreeBSD and LGPL, see license.bsd or license.lgpl for more details. Choose the one which is more convenient for you. For more details have a look
at license.bsd and license.lgpl.
------------- -------------
Create a Feed Create a Feed
------------- -------------
To create a feed simply instanciate the FeedGenerator class and insert some To create a feed simply instantiate the FeedGenerator class and insert some
data:: data::
>>> from feedgenerator.feed import FeedGenerator >>> from feedgenerator.feed import FeedGenerator
@ -31,9 +32,9 @@ data::
Note that for the methods which set fields that can occur more than once in Note that for the methods which set fields that can occur more than once in
a feed you can use all of the following ways to provide data: a feed you can use all of the following ways to provide data:
- Provide the data for that element as keyword arguments:: - Provide the data for that element as keyword arguments
- Provide the data for that element as dictionary:: - Provide the data for that element as dictionary
- Provide a list of dictionaries with the data for several elements:: - Provide a list of dictionaries with the data for several elements
Example:: Example::
@ -67,7 +68,7 @@ instantiation of the FeedEntry object::
>>> fe.title('The First Episode') >>> fe.title('The First Episode')
The FeedGenerators method add_entry(...) without argument provides will The FeedGenerators method add_entry(...) without argument provides will
automaticall generate a new FeedEntry object, append it to the feeds automatically generate a new FeedEntry object, append it to the feeds
internal list of entries and return it, so that additional data can be internal list of entries and return it, so that additional data can be
added. added.
@ -91,7 +92,7 @@ For the episodes of the podcast you should also use PodcastEntry instead of
FeedEntry. However, if you use the add_entry(...) method to generator the FeedEntry. However, if you use the add_entry(...) method to generator the
entry objects, it will take care of that for you. entry objects, it will take care of that for you.
Of cause you can still produce a normat ATOM or RSS feed, even if you use Of cause you can still produce a normal ATOM or RSS feed, even if you use
the PodcastGenerator using the {atom,rss}_{str,file} methods. the PodcastGenerator using the {atom,rss}_{str,file} methods.
--------------------- ---------------------