def get_id_by_filename(key, filename): user = api.user_by_key(key) if not user: abort(404) oid = api.oid_by_name(user, filename) if oid: return oid abort(404)
def link_to_file(key, oid): user = api.user_by_key(key) if not user: abort(404) url = api.url_for(user, oid) if url: return url abort(404)
def debug_upload_file(key): user = api.user_by_key(key) if not user: abort(404) return ''' <!doctype html> <title>Upload new File</title> <h1>Hey %s! Upload a new file</h1> <form action="" method=post enctype=multipart/form-data> <p><input type=file name=file> <input type=submit value=Upload> </form> ''' % user
def upload_file(key): user = api.user_by_key(key) if not user: abort(404) return api.save_file(user, request.files['file'])