Skip to content

Commit

Permalink
Fix of issues jschneier#137 and issue jschneier#138
Browse files Browse the repository at this point in the history
- jschneier#137 I've placed everything on the _save function given that "get_available_name" was not being called when file is written with open () method.
- jschneier#138 No file_overwrite variable is considered. Overwrite is forced, if the file has the same content, dropbox keeps the previous one so no overwrite is reflected.
  • Loading branch information
epetxepe committed Apr 12, 2016
1 parent 134273d commit c51f3b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion storages/backends/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ def _open(self, name, mode='rb'):
return remote_file

def _save(self, name, content):
self.client.put_file(name, content)
name = name.replace ('\\','/')
try:
file_metadata = self.client.metadata(name)
the_rev = file_metadata['rev']
except:
the_rev = ''
self.client.put_file(name, content, overwrite=True, parent_rev=the_rev)
return name

def _read(self, name, num_bytes=None):
Expand Down

0 comments on commit c51f3b6

Please sign in to comment.