From ba8e3f161c03c79cc6a833cbc94a3820e9b87af9 Mon Sep 17 00:00:00 2001 From: "arnaud.morvan@camptocamp.com" Date: Wed, 8 Apr 2020 13:37:58 +0200 Subject: [PATCH] Replace config.set_request_property by config.add_request_method For compatibility with pyramid 1.10 --- pyramid_ldap/__init__.py | 2 +- pyramid_ldap/tests.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyramid_ldap/__init__.py b/pyramid_ldap/__init__.py index 9a543f9..8a38717 100644 --- a/pyramid_ldap/__init__.py +++ b/pyramid_ldap/__init__.py @@ -301,7 +301,7 @@ def get_connector(request): registry = request.registry return Connector(registry, manager) - config.set_request_property(get_connector, 'ldap_connector', reify=True) + config.add_request_method(get_connector, 'ldap_connector', property=True, reify=True) intr = config.introspectable( 'pyramid_ldap setup', diff --git a/pyramid_ldap/tests.py b/pyramid_ldap/tests.py index 4987b87..fce4119 100644 --- a/pyramid_ldap/tests.py +++ b/pyramid_ldap/tests.py @@ -108,6 +108,7 @@ def test_it_defaults(self): self._callFUT(config, 'ldap://') self.assertEqual(config.prop_name, 'ldap_connector') self.assertEqual(config.prop_reify, True) + self.assertEqual(config.prop_property, True) request = testing.DummyRequest() self.assertEqual(config.prop(request).__class__, Connector) @@ -304,7 +305,8 @@ def __init__(self): def add_directive(self, name, fn): self.directives.append(name) - def set_request_property(self, prop, name, reify=False): + def add_request_method(self, prop, name, property=False, reify=False): + self.prop_property = property self.prop_reify = reify self.prop_name = name self.prop = prop