Fixed string check

This commit is contained in:
Lars Kiesow 2013-05-13 17:50:03 +02:00
parent 8086f2112e
commit c56f8a52aa
2 changed files with 4 additions and 4 deletions

View file

@ -253,7 +253,7 @@ class FeedEntry(object):
:returns: Modification date as datetime.datetime :returns: Modification date as datetime.datetime
''' '''
if not updated is None: if not updated is None:
if isinstance(updated, basestr): if isinstance(updated, basestring):
updated = dateutil.parser.parse(updated) updated = dateutil.parser.parse(updated)
if not isinstance(updated, datetime.datetime): if not isinstance(updated, datetime.datetime):
ValueError('Invalid datetime format') ValueError('Invalid datetime format')
@ -515,7 +515,7 @@ class FeedEntry(object):
:returns: Creation date as datetime.datetime :returns: Creation date as datetime.datetime
''' '''
if not published is None: if not published is None:
if isinstance(published, basestr): if isinstance(published, basestring):
published = dateutil.parser.parse(published) published = dateutil.parser.parse(published)
if not isinstance(published, datetime.datetime): if not isinstance(published, datetime.datetime):
ValueError('Invalid datetime format') ValueError('Invalid datetime format')

View file

@ -402,7 +402,7 @@ class FeedGenerator(object):
:returns: Modification date as datetime.datetime :returns: Modification date as datetime.datetime
''' '''
if not updated is None: if not updated is None:
if isinstance(updated, basestr): if isinstance(updated, basestring):
updated = dateutil.parser.parse(updated) updated = dateutil.parser.parse(updated)
if not isinstance(updated, datetime.datetime): if not isinstance(updated, datetime.datetime):
ValueError('Invalid datetime format') ValueError('Invalid datetime format')
@ -817,7 +817,7 @@ class FeedGenerator(object):
:returns: Publication date as datetime.datetime :returns: Publication date as datetime.datetime
''' '''
if not pubDate is None: if not pubDate is None:
if isinstance(pubDate, basestr): if isinstance(pubDate, basestring):
pubDate = dateutil.parser.parse(pubDate) pubDate = dateutil.parser.parse(pubDate)
if not isinstance(pubDate, datetime.datetime): if not isinstance(pubDate, datetime.datetime):
ValueError('Invalid datetime format') ValueError('Invalid datetime format')