Inform when maxage/startdate is in the future
Sometimes it might happen that you put wrong date and you except emails to be fetched, but they are not and you do not have an idea why. By raising exception the user will see a proper message telling that he used the wrong date for maxage/startdate property. If someone wants to set a future date intentionally might as well sync in the future. Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
141abfdf50
commit
92e5455eb4
@ -343,6 +343,10 @@ class BaseFolder(object):
|
|||||||
raise OfflineImapError("maxage led to year %d. "
|
raise OfflineImapError("maxage led to year %d. "
|
||||||
"Abort syncing."% date[0],
|
"Abort syncing."% date[0],
|
||||||
OfflineImapError.ERROR.MESSAGE)
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
|
if (time.mktime(date) - time.mktime(time.localtime())) > 0:
|
||||||
|
raise OfflineImapError("maxage led to future date %s. "
|
||||||
|
"Abort syncing."% maxagestr,
|
||||||
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
return date
|
return date
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise OfflineImapError("invalid maxage value %s"% maxagestr,
|
raise OfflineImapError("invalid maxage value %s"% maxagestr,
|
||||||
@ -364,6 +368,10 @@ class BaseFolder(object):
|
|||||||
raise OfflineImapError("startdate led to year %d. "
|
raise OfflineImapError("startdate led to year %d. "
|
||||||
"Abort syncing."% date[0],
|
"Abort syncing."% date[0],
|
||||||
OfflineImapError.ERROR.MESSAGE)
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
|
if (time.mktime(date) - time.mktime(time.localtime())) > 0:
|
||||||
|
raise OfflineImapError("startdate led to future date %s. "
|
||||||
|
"Abort syncing."% datestr,
|
||||||
|
OfflineImapError.ERROR.MESSAGE)
|
||||||
return date
|
return date
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise OfflineImapError("invalid startdate value %s",
|
raise OfflineImapError("invalid startdate value %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user