Skip to content

Commit

Permalink
improved error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lkiesow committed May 20, 2013
1 parent d2a3fa6 commit 4a7e7ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions feedgen/feed.py
Expand Up @@ -94,7 +94,10 @@ def _create_atom(self, extensions=True):
self.__atom_feed_xml_lang

if not ( self.__atom_id and self.__atom_title and self.__atom_updated ):
raise ValueError('Required fields not set')
missing = ', '.join(([] if self.__atom_title else ['title']) + \
([] if self.__atom_id else ['id']) + \
([] if self.__atom_updated else ['updated']))
raise ValueError('Required fields not set (%s)' % missing)
id = etree.SubElement(feed, 'id')
id.text = self.__atom_id
title = etree.SubElement(feed, 'title')
Expand Down Expand Up @@ -222,7 +225,10 @@ def _create_rss(self, extensions=True):
nsmap={'atom': 'http://www.w3.org/2005/Atom'} )
channel = etree.SubElement(feed, 'channel')
if not ( self.__rss_title and self.__rss_link and self.__rss_description ):
raise ValueError('Required fields not set')
missing = ', '.join(([] if self.__rss_title else ['title']) + \
([] if self.__rss_link else ['link']) + \
([] if self.__rss_description else ['description']))
raise ValueError('Required fields not set (%s)' % missing)
title = etree.SubElement(channel, 'title')
title.text = self.__rss_title
link = etree.SubElement(channel, 'link')
Expand Down Expand Up @@ -375,6 +381,7 @@ def title(self, title=None):
if not title is None:
self.__atom_title = title
self.__rss_title = title
print 'rss-title: ', self.__rss_title

This comment has been minimized.

Copy link
@quonb

quonb Aug 15, 2013

Contributor

What's the point of printing "rss-title: ..."? Maybe this is the debug leftover?

return self.__atom_title


Expand Down

0 comments on commit 4a7e7ad

Please sign in to comment.