changeset 5186:edd5719d5f07

parsedatetime 0.8.7 uses the 2nd element of the returned tuple to indicate what it successfully parsed
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 04 Oct 2009 19:56:57 +0200
parents 0a6fe22644e3
children b766ab8f2009
files MoinMoin/action/fullsearch.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/fullsearch.py	Sun Oct 04 19:32:01 2009 +0200
+++ b/MoinMoin/action/fullsearch.py	Sun Oct 04 19:56:57 2009 +0200
@@ -119,12 +119,12 @@
             else:
                 # didn't work, let's try parsedatetime
                 cal = Calendar()
-                mtime_parsed, invalid_flag = cal.parse(mtime)
+                mtime_parsed, parsed_what = cal.parse(mtime)
                 # XXX it is unclear if usage of localtime here and in parsedatetime module is correct.
                 # time.localtime is the SERVER's local time and of no relevance to the user (being
                 # somewhere in the world)
                 # mktime is reverse function for localtime, so this maybe fixes it again!?
-                if not invalid_flag and mtime_parsed <= time.localtime():
+                if parsed_what > 0 and mtime_parsed <= time.localtime():
                     mtime = time.mktime(mtime_parsed)
                 else:
                     mtime_parsed = None # we don't use invalid stuff