X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=blobdiff_plain;f=python%2Fcumulus%2Fstore%2Ffile.py;h=f343500666aa0c17367345be22072c7b4b1200d4;hp=6b16fb65115f4b5900ba033a0f672f290cb2ab49;hb=65edb87a0b8a578b4a7221478a851d71df21fab0;hpb=fe6bbd9d0b49d6b6e43451f7703894ab02aee73e diff --git a/python/cumulus/store/file.py b/python/cumulus/store/file.py index 6b16fb6..f343500 100644 --- a/python/cumulus/store/file.py +++ b/python/cumulus/store/file.py @@ -5,9 +5,11 @@ import cumulus.store type_patterns = cumulus.store.type_patterns class FileStore(cumulus.store.Store): - def __init__(self, prefix): - while prefix.endswith("/") and prefix != "/": prefix = prefix[:-1] - self.prefix = prefix + def __init__(self, url, **kw): + # if constructor isn't called via factory interpret url as filename + if not hasattr (self, 'path'): + self.path = url + self.prefix = self.path.rstrip("/") def _get_path(self, type, name): return "%s/%s" % (self.prefix, name) @@ -37,4 +39,6 @@ class FileStore(cumulus.store.Store): stat = os.stat(self._get_path(type, name)) return {'size': stat.st_size} except OSError: - raise cumulus.store.NotFoundError + raise cumulus.store.NotFoundError, (type, name) + +Store = FileStore