Proper initialization

This commit is contained in:
Lars Kiesow 2013-05-16 19:04:03 +02:00
parent dd0d742e6d
commit 66689be7ff
5 changed files with 123 additions and 95 deletions

View file

@ -20,38 +20,39 @@ class FeedEntry(object):
node. node.
''' '''
# ATOM def __init__(self):
# required # ATOM
__atom_id = None # required
__atom_title = None self.__atom_id = None
__atom_updated = datetime.now(dateutil.tz.tzutc()) self.__atom_title = None
self.__atom_updated = datetime.now(dateutil.tz.tzutc())
# recommended # recommended
__atom_author = None self.__atom_author = None
__atom_content = None self.__atom_content = None
__atom_link = None self.__atom_link = None
__atom_summary = None self.__atom_summary = None
# optional # optional
__atom_category = None self.__atom_category = None
__atom_contributor = None self.__atom_contributor = None
__atom_source = None self.__atom_source = None
__atom_rights = None self.__atom_rights = None
# RSS # RSS
__rss_author = None self.__rss_author = None
__rss_category = None self.__rss_category = None
__rss_comments = None self.__rss_comments = None
__rss_description = None self.__rss_description = None
__rss_enclosure = None self.__rss_enclosure = None
__rss_guid = None self.__rss_guid = None
__rss_link = None self.__rss_link = None
__rss_pubDate = None self.__rss_pubDate = None
__rss_source = None self.__rss_source = None
__rss_title = None self.__rss_title = None
# Extension list: # Extension list:
__extensions = {} self.__extensions = {}
def atom_entry(self, feed, extensions=True): def atom_entry(self, feed, extensions=True):

View file

@ -19,18 +19,19 @@ class PodcastExtension(BaseExtension):
''' '''
## ITunes tags def __init__(self):
# http://www.apple.com/itunes/podcasts/specs.html#rss ## ITunes tags
__itunes_author = None # http://www.apple.com/itunes/podcasts/specs.html#rss
__itunes_block = None self.__itunes_author = None
__itunes_category = None self.__itunes_block = None
__itunes_image = None self.__itunes_category = None
__itunes_explicit = None self.__itunes_image = None
__itunes_complete = None self.__itunes_explicit = None
__itunes_new_feed_url = None self.__itunes_complete = None
__itunes_owner = None self.__itunes_new_feed_url = None
__itunes_subtitle = None self.__itunes_owner = None
__itunes_summary = None self.__itunes_subtitle = None
self.__itunes_summary = None

View file

@ -19,17 +19,18 @@ class PodcastEntryExtension(BaseEntryExtension):
''' '''
## ITunes tags def __init__(self):
# http://www.apple.com/itunes/podcasts/specs.html#rss ## ITunes tags
__itunes_author = None # http://www.apple.com/itunes/podcasts/specs.html#rss
__itunes_block = None self.__itunes_author = None
__itunes_image = None self.__itunes_block = None
__itunes_duration = None self.__itunes_image = None
__itunes_explicit = None self.__itunes_duration = None
__itunes_is_closed_captioned = None self.__itunes_explicit = None
__itunes_order = None self.__itunes_is_closed_captioned = None
__itunes_subtitle = None self.__itunes_order = None
__itunes_summary = None self.__itunes_subtitle = None
self.__itunes_summary = None
def extend_rss(self, entry): def extend_rss(self, entry):

View file

@ -15,64 +15,72 @@ import dateutil.parser
import dateutil.tz import dateutil.tz
from feedgen.entry import FeedEntry from feedgen.entry import FeedEntry
from feedgen.util import ensure_format from feedgen.util import ensure_format
import feedgen.version
_feedgen_version = feedgen.version.version
_feedgen_version = '0.2.3'
class FeedGenerator(object): class FeedGenerator(object):
'''FeedGenerator for generating ATOM and RSS feeds. '''FeedGenerator for generating ATOM and RSS feeds.
''' '''
__feed_entries = []
## ATOM def __init__(self):
# http://www.atomenabled.org/developers/syndication/ self.__extensions = {}
# required self.__feed_entries = []
__atom_id = None
__atom_title = None
__atom_updated = datetime.now(dateutil.tz.tzutc())
# recommended ## ATOM
__atom_author = None # {name*, uri, email} # http://www.atomenabled.org/developers/syndication/
__atom_link = None # {href*, rel, type, hreflang, title, length} # required
self.__atom_id = None
self.__atom_title = None
self.__atom_updated = datetime.now(dateutil.tz.tzutc())
# optional # recommended
__atom_category = None # {term*, schema, label} self.__atom_author = None # {name*, uri, email}
__atom_contributor = None self.__atom_link = None # {href*, rel, type, hreflang, title, length}
__atom_generator = {'value':'Lernfunk3 FeedGenerator'} #{value*,uri,version}
__atom_icon = None
__atom_logo = None
__atom_rights = None
__atom_subtitle = None
# other # optional
__atom_feed_xml_lang = None self.__atom_category = None # {term*, schema, label}
self.__atom_contributor = None
self.__atom_generator = {
'value' :'python-feedgen',
'url' :'http://lkiesow.github.io/python-feedgen',
'version':feedgen.version.version } #{value*,uri,version}
self.__atom_icon = None
self.__atom_logo = None
self.__atom_rights = None
self.__atom_subtitle = None
## RSS # other
# http://www.rssboard.org/rss-specification self.__atom_feed_xml_lang = None
__rss_title = None
__rss_link = None
__rss_description = None
__rss_category = None ## RSS
__rss_cloud = None # http://www.rssboard.org/rss-specification
__rss_copyright = None self.__rss_title = None
__rss_docs = 'http://www.rssboard.org/rss-specification' self.__rss_link = None
__rss_generator = 'Lernfunk3 FeedGenerator' self.__rss_description = None
__rss_image = None
__rss_language = None
__rss_lastBuildDate = datetime.now(dateutil.tz.tzutc())
__rss_managingEditor = None
__rss_pubDate = None
__rss_rating = None
__rss_skipHours = None
__rss_skipDays = None
__rss_textInput = None
__rss_ttl = None
__rss_webMaster = None
# Extension list: self.__rss_category = None
__extensions = {} self.__rss_cloud = None
self.__rss_copyright = None
self.__rss_docs = 'http://www.rssboard.org/rss-specification'
self.__rss_generator = 'python-feedgen'
self.__rss_image = None
self.__rss_language = None
self.__rss_lastBuildDate = datetime.now(dateutil.tz.tzutc())
self.__rss_managingEditor = None
self.__rss_pubDate = None
self.__rss_rating = None
self.__rss_skipHours = None
self.__rss_skipDays = None
self.__rss_textInput = None
self.__rss_ttl = None
self.__rss_webMaster = None
# Extension list:
__extensions = {}
def _create_atom(self, extensions=True): def _create_atom(self, extensions=True):

17
feedgen/version.py Normal file
View file

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
'''
feedgen.version
~~~~~~~~~~~~~~~
:copyright: 2013, Lars Kiesow <lkiesow@uos.de>
:license: FreeBSD and LGPL, see license.* for more details.
'''
'Version of python-feedgen represented as tuple'
version_elements = (0, 2, 3)
'Version of python-feedgen represented as string'
version = '.'.join([str(x) for x in version_elements])