Package: python3-bottle-sqlite
Version: 0.2.0-4
Severity: normal
X-Debbugs-Cc: IOhannes m zmölnig (Debian/GNU) <[email protected]>

Hi,

I found out today this library is broken since Bookworm.

Here is a quite short patch.
I guess it would be possible to make it even shorter.

https://github.com/bottlepy/bottle-sqlite/pull/30

I plane to fix it in Stable too.

Greetings

Alexandre



From 5fcbeee0212cc879ba441e5db43074fdbc2dfdd8 Mon Sep 17 00:00:00 2001
From: "crown.hg" <[email protected]>
Date: Fri, 17 May 2024 10:00:46 +0800
Subject: [PATCH] fix: AttributeError: module 'inspect' has no attribute
 'getargspec'.

--- a/bottle_sqlite.py
+++ b/bottle_sqlite.py
@@ -111,8 +111,16 @@ def apply(self, callback, route):
 
         # Test if the original callback accepts a 'db' keyword.
         # Ignore it if it does not need a database handle.
-        argspec = inspect.getargspec(_callback)
-        if keyword not in argspec.args:
+        cbargs = []
+        if hasattr(inspect, 'getargspec'):
+            argspec = inspect.getargspec(_callback)
+            cbargs = argspec.args
+
+        if hasattr(inspect, 'getfullargspec'):
+            fullArgSpec = inspect.getfullargspec(_callback)
+            cbargs = fullArgSpec.args
+
+        if keyword not in cbargs:
             return callback
 
         def wrapper(*args, **kwargs):

Reply via email to