Fix the implementation of local userfiles and switch master_branch to default_branch to match the github api.

This commit is contained in:
jakedt 2014-04-16 22:35:47 -04:00
parent 63cf8beb26
commit be728ceccb
2 changed files with 15 additions and 8 deletions

View file

@ -6,7 +6,7 @@ import magic
from boto.s3.key import Key
from uuid import uuid4
from flask import url_for, request, send_file
from flask import url_for, request, send_file, make_response
from flask.views import View
@ -111,6 +111,8 @@ class UserfilesHandlers(View):
self._userfiles.store_stream(input_stream, file_id)
return make_response('Okay')
def dispatch_request(self, file_id):
if request.method == 'GET':
return self.get(file_id)
@ -158,7 +160,11 @@ class LocalUserfiles(object):
def store_file(self, file_like_obj, content_type):
file_id = str(uuid4())
self.store_stream(file_like_obj, content_type)
# Rewind the file to match what s3 does
file_like_obj.seek(0, os.SEEK_SET)
self.store_stream(file_like_obj, file_id)
return file_id
def get_file_url(self, file_id, expires_in=300):