Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Deprecate saving new files to S3
Browse files Browse the repository at this point in the history
Summary: Nothing should be using S3 anymore

Reviewers: paulruan

Reviewed By: paulruan

Subscribers: changesbot, kylec

Differential Revision: https://tails.corp.dropbox.com/D220192
  • Loading branch information
ecnerwala committed Aug 15, 2016
1 parent b17aaa0 commit f7e49c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 1 addition & 6 deletions changes/storage/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ def get_file_path(self, filename):
return '/'.join([self.path.rstrip('/'), filename])

def save(self, filename, fp, content_type=None, path=None):
key = self.bucket.new_key(self.get_file_path(filename))
if content_type:
key.content_type = content_type
key.set_contents_from_file(fp)
key.set_acl('private')
return filename
raise NotImplementedError('Saving artifacts to S3 is deprecated')

def url_for(self, filename, expire=300):
key = self.bucket.get_key(self.get_file_path(filename))
Expand Down
4 changes: 3 additions & 1 deletion tests/changes/storage/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def test_simple(self):
bucket='foo',
path='artifacts/',
)
storage.save('filename.txt', fp)
key = storage.bucket.new_key(storage.get_file_path('filename.txt'))
key.set_contents_from_file(fp)
key.set_acl('private')

result = storage.url_for('filename.txt')
assert result.startswith('https://foo.s3.amazonaws.com/artifacts/filename.txt?')

0 comments on commit f7e49c2

Please sign in to comment.