From 3da2c5596437ddedcdad7227f24c822e98e1e9d4 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 25 2016 13:52:12 +0000 Subject: Fix the recursion so that we don't end up in an infinite loop --- diff --git a/mdapi/lib.py b/mdapi/lib.py index bc0b79f..67d7f3b 100644 --- a/mdapi/lib.py +++ b/mdapi/lib.py @@ -98,12 +98,12 @@ def get_package(session, pkg_name): return output -def get_package_by(session, tablename, key): +def get_package_by(session, tablename, key, cnt=None): ''' Return information the package providing the provides, if we can find it. ''' table = getattr(primary, tablename.capitalize()) - cnt = 0 + cnt = cnt or 0 try: pkg = session.query( primary.Package @@ -123,7 +123,7 @@ def get_package_by(session, tablename, key): raise else: time.sleep(0.1) - output = get_package_by_provides(session, pkg_name) + output = get_package_by(session, tablename, key, cnt=cnt) return output