The unified diff between revisions [8c5c8a3d..] and [e331aa42..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'storage.py'
#
#
# patch "storage.py"
# from [15df0aaa6f37d41868a4e7b75beb834d7caea7e2]
# to [42dc917e0234c29279bfcbc1c6756f5cfc965446]
#
============================================================
--- storage.py 15df0aaa6f37d41868a4e7b75beb834d7caea7e2
+++ storage.py 42dc917e0234c29279bfcbc1c6756f5cfc965446
@@ -12,14 +12,14 @@ class Storage:
pass
class Storage:
- def __init__(self, uri):
- self.uri = uri
+ def __init__(self, site, uri):
+ self.site, self.uri = site, uri
self.dir = self.__storage_dir()
def __storage_dir(self):
# list of directories in the storage path to get to this URI
dirs = []
- site = filter(lambda x: x in string.letters or x in string.digits or x == '.', urlparse.urlparse(self.uri)[1])
+ site = filter(lambda x: x in string.letters or x in string.digits or x == '.', self.site)
# no .. entries to climb the filesystem :-)
site = site.lstrip('.')
dirs.append(site)
@@ -48,6 +48,18 @@ class Storage:
timestamp = os.stat(fname)[stat.ST_MTIME]
return datetime.datetime.fromtimestamp(timestamp)
+ def timestamp(self, fname):
+ fname = self.file(fname)
+ if not os.access(fname, os.R_OK):
+ open(fname, 'w')
+ os.utime(fname, None)
+
+ def unlink(self, fname):
+ try:
+ os.unlink(self.file(fname))
+ except OSError:
+ pass
+
def has_file(self, fname):
return os.access(self.file(fname), os.R_OK)