summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Bicking <ian@ianbicking.org>2007-09-15 17:53:56 +0000
committerIan Bicking <ian@ianbicking.org>2007-09-15 17:53:56 +0000
commit5b3449980e81eeec99770daf2cbc2dd7ba98ac6a (patch)
tree3980c9102d420e4bc3824c59013693db22d941b8
parent1cf35b216d02bfa8fa19c2fa1261e20c272af803 (diff)
downloadpaste-git-5b3449980e81eeec99770daf2cbc2dd7ba98ac6a.tar.gz
In paste.session, ignore files that aren't session files
-rw-r--r--docs/news.txt3
-rw-r--r--paste/session.py18
2 files changed, 14 insertions, 7 deletions
diff --git a/docs/news.txt b/docs/news.txt
index 768899e..33474f0 100644
--- a/docs/news.txt
+++ b/docs/news.txt
@@ -13,6 +13,9 @@ svn trunk
``'application/x-www-form-urlencoded'`` whenever there are
parameters (and no other content type was provided).
+* In ``paste.session``, when cleaning files ignore files that aren't
+ session files.
+
1.4.2
-----
diff --git a/paste/session.py b/paste/session.py
index e0ab242..fdcaff2 100644
--- a/paste/session.py
+++ b/paste/session.py
@@ -235,13 +235,17 @@ class FileSession(object):
if len(t) != 2:
return
t = t[0]
- sess_time = datetime.datetime(
- int(t[0:4]),
- int(t[4:6]),
- int(t[6:8]),
- int(t[8:10]),
- int(t[10:12]),
- int(t[12:14]))
+ try:
+ sess_time = datetime.datetime(
+ int(t[0:4]),
+ int(t[4:6]),
+ int(t[6:8]),
+ int(t[8:10]),
+ int(t[10:12]),
+ int(t[12:14]))
+ except ValueError:
+ # Probably not a session file at all
+ return
if sess_time + exp_time < now:
os.remove(os.path.join(self.session_file_path, f))