Skip to content
Snippets Groups Projects
Verified Commit 64069b9b authored by Kevin Morris's avatar Kevin Morris
Browse files

change(python): use a transaction query in get_pkg_or_base


Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 9441f4f9
No related branches found
No related tags found
No related merge requests found
......@@ -103,11 +103,13 @@ def get_pkg_or_base(
if provider:
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
instance = db.query(cls).filter(cls.Name == name).first()
with db.begin():
instance = db.query(cls).filter(cls.Name == name).first()
if not instance:
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
return db.refresh(instance)
return instance
def get_pkgbase_comment(pkgbase: models.PackageBase, id: int) \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment