From d0dc80485274310c5e6d261228564ee1fbb63f35 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 12 2020 11:41:44 +0000 Subject: Avoid overriding the pkg variable since it's the one returned Otherwise, we end up returning something which is not what the rest of the code expects Signed-off-by: Pierre-Yves Chibon --- diff --git a/mdapi/__init__.py b/mdapi/__init__.py index c6f4deb..d9c811e 100644 --- a/mdapi/__init__.py +++ b/mdapi/__init__.py @@ -86,9 +86,9 @@ async def _get_pkg(branch, name=None, action=None, srcname=None): # user. query = GET_PACKAGE_BY.format(action) async with db.execute(query, (name,)) as cursor: - pkg = await cursor.fetchall() - if pkg: - pkg = [Packages(*item) for item in pkg] + pkgc = await cursor.fetchall() + if pkgc: + pkg = [Packages(*item) for item in pkgc] break elif srcname: pattern = re.compile(f"{srcname}-[0-9]") @@ -101,9 +101,9 @@ async def _get_pkg(branch, name=None, action=None, srcname=None): break else: async with db.execute(GET_PACKAGE, (name,)) as cursor: - pkg = await cursor.fetchone() - if pkg: - pkg = Packages(*pkg) + pkgc = await cursor.fetchone() + if pkgc: + pkg = Packages(*pkgc) break if wrongdb: raise web.HTTPBadRequest()