diff options
| author | Chris McDonough <chrism@plope.com> | 2012-08-16 02:50:30 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-08-16 02:50:30 -0400 |
| commit | c7cc885483dadeb44b5e9b900e01d61ca743a664 (patch) | |
| tree | c775e44349a2e1e66ecdfc4dca73816515db3399 | |
| parent | 6b180cbb77d6c5bee0e75220d93fc1800d1217df (diff) | |
| download | pyramid-c7cc885483dadeb44b5e9b900e01d61ca743a664.tar.gz pyramid-c7cc885483dadeb44b5e9b900e01d61ca743a664.tar.bz2 pyramid-c7cc885483dadeb44b5e9b900e01d61ca743a664.zip | |
- Use nicer spelling for generating a bound method (thanks to Raydeo and http://stackoverflow.com/a/1015405/209039)
| -rw-r--r-- | pyramid/config/__init__.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pyramid/config/__init__.py b/pyramid/config/__init__.py index a45dca255..547fa9e4a 100644 --- a/pyramid/config/__init__.py +++ b/pyramid/config/__init__.py @@ -4,7 +4,6 @@ import logging import operator import os import sys -import types import warnings import venusian @@ -23,7 +22,6 @@ from pyramid.compat import ( text_, reraise, string_types, - PY3, ) from pyramid.events import ApplicationCreated @@ -786,10 +784,9 @@ class Configurator( c, action_wrap = c if action_wrap: c = action_method(c) - if PY3: # pragma: no cover - m = types.MethodType(c, self) - else: - m = types.MethodType(c, self, self.__class__) + # Create a bound method (works on both Py2 and Py3) + # http://stackoverflow.com/a/1015405/209039 + m = c.__get__(self, self.__class__) return m def with_package(self, package): |
