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.
'''
# ATOM
# required
__atom_id = None
__atom_title = None
__atom_updated = datetime.now(dateutil.tz.tzutc())
def __init__(self):
# ATOM
# required
self.__atom_id = None
self.__atom_title = None
self.__atom_updated = datetime.now(dateutil.tz.tzutc())
# recommended
__atom_author = None
__atom_content = None
__atom_link = None
__atom_summary = None
# recommended
self.__atom_author = None
self.__atom_content = None
self.__atom_link = None
self.__atom_summary = None
# optional
__atom_category = None
__atom_contributor = None
__atom_source = None
__atom_rights = None
# optional
self.__atom_category = None
self.__atom_contributor = None
self.__atom_source = None
self.__atom_rights = None
# RSS
__rss_author = None
__rss_category = None
__rss_comments = None
__rss_description = None
__rss_enclosure = None
__rss_guid = None
__rss_link = None
__rss_pubDate = None
__rss_source = None
__rss_title = None
# RSS
self.__rss_author = None
self.__rss_category = None
self.__rss_comments = None
self.__rss_description = None
self.__rss_enclosure = None
self.__rss_guid = None
self.__rss_link = None
self.__rss_pubDate = None
self.__rss_source = None
self.__rss_title = None
# Extension list:
__extensions = {}
# Extension list:
self.__extensions = {}
def atom_entry(self, feed, extensions=True):

View file

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

View file

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

View file

@ -15,64 +15,72 @@ import dateutil.parser
import dateutil.tz
from feedgen.entry import FeedEntry
from feedgen.util import ensure_format
import feedgen.version
_feedgen_version = feedgen.version.version
_feedgen_version = '0.2.3'
class FeedGenerator(object):
'''FeedGenerator for generating ATOM and RSS feeds.
'''
__feed_entries = []
## ATOM
# http://www.atomenabled.org/developers/syndication/
# required
__atom_id = None
__atom_title = None
__atom_updated = datetime.now(dateutil.tz.tzutc())
def __init__(self):
self.__extensions = {}
self.__feed_entries = []
# recommended
__atom_author = None # {name*, uri, email}
__atom_link = None # {href*, rel, type, hreflang, title, length}
## ATOM
# http://www.atomenabled.org/developers/syndication/
# required
self.__atom_id = None
self.__atom_title = None
self.__atom_updated = datetime.now(dateutil.tz.tzutc())
# optional
__atom_category = None # {term*, schema, label}
__atom_contributor = None
__atom_generator = {'value':'Lernfunk3 FeedGenerator'} #{value*,uri,version}
__atom_icon = None
__atom_logo = None
__atom_rights = None
__atom_subtitle = None
# recommended
self.__atom_author = None # {name*, uri, email}
self.__atom_link = None # {href*, rel, type, hreflang, title, length}
# other
__atom_feed_xml_lang = None
# optional
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
# http://www.rssboard.org/rss-specification
__rss_title = None
__rss_link = None
__rss_description = None
# other
self.__atom_feed_xml_lang = None
__rss_category = None
__rss_cloud = None
__rss_copyright = None
__rss_docs = 'http://www.rssboard.org/rss-specification'
__rss_generator = 'Lernfunk3 FeedGenerator'
__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
## RSS
# http://www.rssboard.org/rss-specification
self.__rss_title = None
self.__rss_link = None
self.__rss_description = None
# Extension list:
__extensions = {}
self.__rss_category = None
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):

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])