From f47783cfb0cc45b63074ec5c6ec8a4fea487543e Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Tue, 14 May 2013 17:53:18 +0200 Subject: [PATCH] Fixed that ValueError was not raised --- feedgen/entry.py | 8 ++++---- feedgen/feed.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/feedgen/entry.py b/feedgen/entry.py index 6c9b3c9..c5ec77d 100644 --- a/feedgen/entry.py +++ b/feedgen/entry.py @@ -256,9 +256,9 @@ class FeedEntry(object): if isinstance(updated, basestring): updated = dateutil.parser.parse(updated) if not isinstance(updated, datetime): - ValueError('Invalid datetime format') + raise ValueError('Invalid datetime format') if updated.tzinfo is None: - ValueError('Datetime object has no timezone info') + raise ValueError('Datetime object has no timezone info') self.__atom_updated = updated self.__rss_lastBuildDate = updated @@ -518,9 +518,9 @@ class FeedEntry(object): if isinstance(published, basestring): published = dateutil.parser.parse(published) if not isinstance(published, datetime): - ValueError('Invalid datetime format') + raise ValueError('Invalid datetime format') if published.tzinfo is None: - ValueError('Datetime object has no timezone info') + raise ValueError('Datetime object has no timezone info') self.__atom_published = published self.__rss_pubDate = published diff --git a/feedgen/feed.py b/feedgen/feed.py index 43979cb..f03e58d 100644 --- a/feedgen/feed.py +++ b/feedgen/feed.py @@ -405,9 +405,9 @@ class FeedGenerator(object): if isinstance(updated, basestring): updated = dateutil.parser.parse(updated) if not isinstance(updated, datetime.datetime): - ValueError('Invalid datetime format') + raise ValueError('Invalid datetime format') if updated.tzinfo is None: - ValueError('Datetime object has no timezone info') + raise ValueError('Datetime object has no timezone info') self.__atom_updated = updated self.__rss_lastBuildDate = updated @@ -820,9 +820,9 @@ class FeedGenerator(object): if isinstance(pubDate, basestring): pubDate = dateutil.parser.parse(pubDate) if not isinstance(pubDate, datetime.datetime): - ValueError('Invalid datetime format') + raise ValueError('Invalid datetime format') if pubDate.tzinfo is None: - ValueError('Datetime object has no timezone info') + raise ValueError('Datetime object has no timezone info') self.__rss_pubDate = pubDate return self.__rss_pubDate @@ -853,7 +853,7 @@ class FeedGenerator(object): hours = [hours] for h in hours: if not h in xrange(24): - ValueError('Invalid hour %s' % h) + raise ValueError('Invalid hour %s' % h) if replace or not self.__rss_skipHours: self.__rss_skipHours = set() self.__rss_skipHours |= set(hours) @@ -877,7 +877,7 @@ class FeedGenerator(object): for d in days: if not d in ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']: - ValueError('Invalid day %s' % h) + raise ValueError('Invalid day %s' % h) if replace or not self.__rss_skipDays: self.__rss_skipDays = set() self.__rss_skipDays |= set(days)