diff --git a/wcs/qommon/storage.py b/wcs/qommon/storage.py index 10c8cedaf..c7ca3b4d0 100644 --- a/wcs/qommon/storage.py +++ b/wcs/qommon/storage.py @@ -1,4 +1,5 @@ import os +import time import pickle from quixote import get_publisher @@ -332,11 +333,21 @@ class StorableObject(object): def last_modified_id(cls, id): filename = os.path.join(cls.get_objects_dir(), fix_key(id)) - stat = os.stat(filename) - return stat.st_mtime + mtime = 0 + try: + stat = os.stat(filename) + mtime = stat.st_mtime + except OSError: + mtime = int(time.time()) + return mtime last_modified_id = classmethod(last_modified_id) def last_modified(cls): - stat = os.stat(cls.get_objects_dir()) - return stat.st_mtime + mtime = 0 + try: + stat = os.stat(cls.get_objects_dir()) + mtime = stat.st_mtime + except OSError: + mtime = int(time.time()) + return mtime last_modified = classmethod(last_modified)