mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(python): use a transaction query in get_pkg_or_base
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
9441f4f904
commit
64069b9b5d
1 changed files with 4 additions and 2 deletions
|
@ -103,11 +103,13 @@ def get_pkg_or_base(
|
||||||
if provider:
|
if provider:
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
|
with db.begin():
|
||||||
instance = db.query(cls).filter(cls.Name == name).first()
|
instance = db.query(cls).filter(cls.Name == name).first()
|
||||||
|
|
||||||
if not instance:
|
if not instance:
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
return db.refresh(instance)
|
return instance
|
||||||
|
|
||||||
|
|
||||||
def get_pkgbase_comment(pkgbase: models.PackageBase, id: int) \
|
def get_pkgbase_comment(pkgbase: models.PackageBase, id: int) \
|
||||||
|
|
Loading…
Add table
Reference in a new issue