From b61e022115690ef1d3523384b879c0bfcab6e478 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 30 Apr 2013 17:08:50 -0400 Subject: [PATCH] Fix a PY3-bug when using ``transcational`` as a class decorator. Previously this was using ``inspect.ismethod``, which doesn't have the same meaning in Python3. --- pecan/decorators.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pecan/decorators.py b/pecan/decorators.py index e5afb9f..2938fc1 100644 --- a/pecan/decorators.py +++ b/pecan/decorators.py @@ -1,4 +1,6 @@ -from inspect import getargspec, getmembers, isclass, ismethod +from inspect import getargspec, getmembers, isclass, ismethod, isfunction + +import six from .util import _cfg @@ -75,7 +77,10 @@ def transactional(ignore_redirects=True): def deco(f): if isclass(f): - for meth in [m[1] for m in getmembers(f) if ismethod(m[1])]: + for meth in [ + m[1] for m in getmembers(f) + if (isfunction if six.PY3 else ismethod)(m[1]) + ]: if getattr(meth, 'exposed', False): _cfg(meth)['transactional'] = True _cfg(meth)['transactional_ignore_redirects'] = _cfg(