projects
/
cumulus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up database, and timestamp handling in particular.
[cumulus.git]
/
python
/
cumulus
/
store
/
file.py
diff --git
a/python/cumulus/store/file.py
b/python/cumulus/store/file.py
index
3d536bf
..
8304401
100644
(file)
--- a/
python/cumulus/store/file.py
+++ b/
python/cumulus/store/file.py
@@
-33,16
+33,19
@@
class FileStore(cumulus.store.Store):
return os.path.join(self.prefix, type, name)
def list(self, subdir):
return os.path.join(self.prefix, type, name)
def list(self, subdir):
- return os.listdir(os.path.join(self.prefix, subdir))
+ try:
+ return os.listdir(os.path.join(self.prefix, subdir))
+ except OSError:
+ raise cumulus.store.NotFoundError(subdir)
def get(self, path):
def get(self, path):
- return open(os.path.join(self.prefix, path), 'rb')
+ try:
+ return open(os.path.join(self.prefix, path), 'rb')
+ except IOError:
+ raise cumulus.store.NotFoundError(path)
def put(self, path, fp):
def put(self, path, fp):
- # TODO: Implement
- raise NotImplementedError
- k = self._get_path(type, name)
- out = open(k, 'wb')
+ out = open(os.path.join(self.prefix, path), 'wb')
buf = fp.read(4096)
while len(buf) > 0:
out.write(buf)
buf = fp.read(4096)
while len(buf) > 0:
out.write(buf)