Skip to content

Commit

Permalink
Fix #408 for good
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Oct 16, 2014
1 parent e6eadb0 commit 8e7ed81
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion feincms/module/extensions/datepublisher.py
Expand Up @@ -20,6 +20,12 @@

from feincms import extensions

try:
from pytz import InvalidTimeError
except ImportError:
# Fall back to a catch-all
InvalidTimeError = Exception


# ------------------------------------------------------------------------
def format_date(d, if_none=''):
Expand Down Expand Up @@ -71,7 +77,10 @@ def datepublisher_response_processor(page, request, response):
if expires is not None:
delta = expires - timezone.now()
delta = int(delta.days * 86400 + delta.seconds)
patch_response_headers(response, delta)
try:
patch_response_headers(response, delta)
except InvalidTimeError: # NonExistentTimeError and AmbiguousTimeError
patch_response_headers(response, delta - 7200)


# ------------------------------------------------------------------------
Expand Down

0 comments on commit 8e7ed81

Please sign in to comment.