#!/usr/bin/python
+import errno
import tornado.web
from ..errors import NoSuchDistroError
@base.negotiate
async def post(self):
# Fetch the upload
- upload = self.get_argument_upload("upload_id")
+ upload = self.get_argument_upload("upload")
if not upload:
raise tornado.web.HTTPError(404, "Could not find upload")
# Check permissions of the upload
if not upload.has_perm(self.current_user):
- raise tornado.web.HTTPError(403, "No permission for using upload %s" % upload)
+ raise base.APIError(errno.ENOPERM, "No permission for using upload %s" % upload)
# Fetch the repository
repo_name = self.get_argument("repo", None)
# If the distribution that is coded into the package could not be found,
# we will send that error to the user...
except NoSuchDistroError as e:
- raise tornado.web.HTTPError(404, "Could not find distribution: %s" % e)
+ raise base.APIError(errno.ENOENT, "Could not find distribution: %s" % e)
try:
# Find the repository
repo = self.current_user.get_repo(package.distro, repo_name)
if not repo:
- raise tornado.web.HTTPError(404, "Could not find repository")
+ raise base.APIError(errno.ENOENT, "Could not find repository")
# Create a new build
build = await self.backend.builds.create(repo, package,