You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/usr/lib/python2.7/dist-packages/bottle.py:527: DeprecationWarning: Switch to Plugin API v2 and access the Route object directly.
context = self if api > 1 else self._context
diff --git 1/venv/lib/python3.8/site-packages/bottle_pgsql.py.orig 2/venv/lib/python3.8/site-packages/bottle_pgsql.py
index f65f808..b8d5219 100644
--- 1/venv/lib/python3.8/site-packages/bottle_pgsql.py.orig+++ 2/venv/lib/python3.8/site-packages/bottle_pgsql.py@@ -51,6 +51,7 @@ class PgSQLPlugin(object):
'''
name = 'pgsql'
+ api = 2
def __init__(self, dsn=None, autocommit=True, dictrows=True, keyword='db'):
self.dsn = dsn
@@ -68,9 +69,11 @@ class PgSQLPlugin(object):
if other.keyword == self.keyword:
raise PluginError("Found another pgsql plugin with conflicting settings (non-unique keyword).")
- def apply(self, callback, context):+ def apply(self, callback, route):
# Override global configuration with route-specific values.
- conf = context['config'].get('pgsql') or {}+ config = route.config+ _callback = route.callback+ conf = config.get('pgsql') or {}
dsn = conf.get('dsn', self.dsn)
autocommit = conf.get('autocommit', self.autocommit)
dictrows = conf.get('dictrows', self.dictrows)
@@ -78,7 +81,7 @@ class PgSQLPlugin(object):
# Test if the original callback accepts a 'db' keyword.
# Ignore it if it does not need a database handle.
- args = inspect.getargspec(context['callback'])[0]+ args = inspect.signature(_callback).parameters
if keyword not in args:
return callback
Solves both of these warnings:
venv/lib/python3.8/site-packages/bottle.py:539: DeprecationWarning: Switch to Plugin API v2 and access the Route object directly.
context = self if api > 1 else self._context
venv/lib/python3.8/site-packages/bottle_pgsql.py:81: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
args = inspect.getargspec(context['callback'])[0]
Similar to bottlepy/bottle-sqlite#10,
bottle
now complains when loading the plugin:See bottlepy/bottle-redis#3 for the way bottle-redis fixed the issue.
The text was updated successfully, but these errors were encountered: