"""
Deletes an upload with a certain UUID
"""
+ # Fetch the current user
+ current_user = await self.get_current_user()
+
# Fetch the upload
- upload = self.backend.uploads.get_by_uuid(uuid)
+ upload = await self.backend.uploads.get_by_uuid(uuid)
if not upload:
raise tornado.web.HTTPError(404, "Could not find upload %s" % uuid)
# Check for permissions
- if not upload.has_perm(self.current_user):
+ if not upload.has_perm(current_user):
raise tornado.web.HTTPError(403, "%s has no permission to delete %s" \
- % (self.current_user, upload))
+ % (current_user, upload))
# Delete the upload
- with self.db.transaction():
+ async with await self.db.transaction():
await upload.delete()
# Send a positive response