Change adapter_fimfictionnet to use makeDate for non-USEnglish locales.

This commit is contained in:
Jim Miller 2017-06-17 15:50:14 -05:00
parent 3ae9b0f86b
commit 4382451fa6
2 changed files with 6 additions and 5 deletions

View file

@ -43,6 +43,7 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter):
# The date format will vary from site to site.
# http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# FYI, not the only format used in this file.
self.dateformat = "%d %b %Y"
@staticmethod
@ -326,7 +327,7 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter):
span = containingtag.find('span', title=True)
dateRegex = re.search('([a-zA-Z ]+)([0-9]+)(th of|nd of|rd of)([a-zA-Z ]+[0-9]+)', span['title'])
dateString = dateRegex.group(2) + dateRegex.group(4)
return datetime.strptime(dateString, "%d %B %Y")
return makeDate(dateString, "%d %B %Y")
def ordinal_date_string_to_date(self, datestring):
datestripped=re.sub(r"(\d+)(st|nd|rd|th)", r"\1", datestring.strip())

View file

@ -479,10 +479,10 @@ def makeDate(string,dateform):
# just saving bytes.
# fudge english month names for people who's locale is set to
# non-english. All our current sites date in english, even if
# there's non-english content. -- ficbook.net now makes that a
# lie. It has to do something even more complicated to get
# Russian month names correct everywhere.
# non-USenglish. Most current sites date in english, even if
# there's non-english content -- ficbook.net, OTOH, has to do
# something even more complicated to get Russian month names
# correct everywhere.
do_abbrev = "%b" in dateform
if u"%B" in dateform or do_abbrev: