-class S3Store(cumulus.store.Store):
- def __init__(self, url, **kw):
- # Old versions of the Python urlparse library will take a URL like
- # s3://bucket/path/ and include the bucket with the path, while new
- # versions (2.6 and later) treat it as the netloc (which seems more
- # correct).
- #
- # But, so that we can work with either behavior, for now just combine
- # the netloc and path together before we do any further processing
- # (which will then split the combined path apart into a bucket and path
- # again). If we didn't want to support Python 2.5, this would be
- # easier as we could just use the netloc as the bucket directly.
- path = self.netloc + '/' + self.path
- (bucket, prefix) = path.lstrip("/").split("/", 1)
+def throw_notfound(method):
+ """Decorator to convert a 404 error into a cumulus.store.NoutFoundError."""
+ def f(*args, **kwargs):
+ try:
+ return method(*args, **kwargs)
+ except S3ResponseError as e:
+ if e.status == 404:
+ raise cumulus.store.NotFoundError(e)
+ else:
+ raise
+ return f
+
+class Store(cumulus.store.Store):
+ def __init__(self, url):
+ super(Store, self).__init__(url)