diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2013-04-30 17:08:50 -0400 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2013-04-30 17:25:25 -0400 |
commit | b61e022115690ef1d3523384b879c0bfcab6e478 (patch) | |
tree | f28a2bf89154a7f47beb80d05ea0ff2f6ae09e21 | |
parent | 9dd59a13957ea9c93d0c2184077236474e142399 (diff) | |
download | pecan-b61e022115690ef1d3523384b879c0bfcab6e478.tar.gz |
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.
-rw-r--r-- | pecan/decorators.py | 9 |
1 files 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( |