From c7cc885483dadeb44b5e9b900e01d61ca743a664 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 16 Aug 2012 02:50:30 -0400 Subject: - Use nicer spelling for generating a bound method (thanks to Raydeo and http://stackoverflow.com/a/1015405/209039) --- pyramid/config/__init__.py | 9 +++------ 1 file 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): -- cgit v1.2.3