diff options
author | Sascha Silbe <sascha@silbe.org> | 2009-08-19 13:01:50 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-08-21 09:07:46 (GMT) |
commit | 07b74725415a2c501383b9f074d18519ac817887 (patch) | |
tree | cd847e9f8a2941672a543f920112228ca669ab3f /src/carquinyol/filestore.py | |
parent | 2fe11309a17c50fcb5b89c54ca1beb6d322e6978 (diff) |
use layoutmanager as much as possible
Diffstat (limited to 'src/carquinyol/filestore.py')
-rw-r--r-- | src/carquinyol/filestore.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/carquinyol/filestore.py b/src/carquinyol/filestore.py index b96c323..0e018bd 100644 --- a/src/carquinyol/filestore.py +++ b/src/carquinyol/filestore.py @@ -39,7 +39,7 @@ class FileStore(object): if not os.path.exists(dir_path): os.makedirs(dir_path) - destination_path = os.path.join(dir_path, 'data') + destination_path = layoutmanager.get_instance().get_data_path(uid) if file_path: if not os.path.isfile(file_path): raise ValueError('No file at %r' % file_path) @@ -83,8 +83,7 @@ class FileStore(object): deleting this file. """ - dir_path = layoutmanager.get_instance().get_entry_path(uid) - file_path = os.path.join(dir_path, 'data') + file_path = layoutmanager.get_instance().get_data_path(uid) if not os.path.exists(file_path): logging.debug('Entry %r doesnt have any file' % uid) return '' @@ -145,25 +144,19 @@ class FileStore(object): return destination_path def get_file_path(self, uid): - dir_path = layoutmanager.get_instance().get_entry_path(uid) - return os.path.join(dir_path, 'data') + return layoutmanager.get_instance().get_data_path(uid) def delete(self, uid): """Remove the file associated to a given entry. """ - dir_path = layoutmanager.get_instance().get_entry_path(uid) - file_path = os.path.join(dir_path, 'data') + file_path = layoutmanager.get_instance().get_data_path(uid) if os.path.exists(file_path): os.remove(file_path) def hard_link_entry(self, new_uid, existing_uid): - existing_file = os.path.join( - layoutmanager.get_instance().get_entry_path(existing_uid), - 'data') - new_file = os.path.join( - layoutmanager.get_instance().get_entry_path(new_uid), - 'data') + existing_file = layoutmanager.get_instance().get_data_path(existing_uid) + new_file = layoutmanager.get_instance().get_data_path(new_uid) logging.debug('removing %r' % new_file) os.remove(new_file) |