Author: eallen
Date: 2009-10-26 09:39:17 -0400 (Mon, 26 Oct 2009)
New Revision: 3685
Modified:
mgmt/trunk/wooly/python/wooly/server.py
Log:
Trap and log exception occurring in python libraries when calculating modified since
date/time
Modified: mgmt/trunk/wooly/python/wooly/server.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/server.py 2009-10-23 17:49:21 UTC (rev 3684)
+++ mgmt/trunk/wooly/python/wooly/server.py 2009-10-26 13:39:17 UTC (rev 3685)
@@ -6,7 +6,10 @@
from wooly import *
from devel import DevelPage
from wsgiserver import CherryPyWSGIServer
+import logging
+log = logging.getLogger("wooly.server")
+
class WebServer(object):
http_date = "%a, %d %b %Y %H:%M:%S %Z"
http_date_gmt = "%a, %d %b %Y %H:%M:%S GMT"
@@ -71,10 +74,14 @@
modified = page.get_last_modified(session).replace(microsecond=0)
if ims:
- since = datetime(*strptime(str(ims), self.http_date)[0:6])
+ try:
+ since = datetime(*strptime(str(ims), self.http_date)[0:6])
- if modified <= since:
- return self.send_not_modified(response, headers, session)
+ if modified <= since:
+ return self.send_not_modified(response, headers, session)
+ except AttributeError:
+ log.error("Exception in If Modified Since. ims=%s" % str(ims))
+ pass
if modified:
when = modified.strftime(self.http_date_gmt)