diff options
| author | Gael Pasgrimaud <gael@gawel.org> | 2011-01-12 22:01:16 +0100 |
|---|---|---|
| committer | Gael Pasgrimaud <gael@gawel.org> | 2011-01-12 22:01:16 +0100 |
| commit | 035d033169f48d8250afafedd0a078d3e4f62922 (patch) | |
| tree | b5dac954f037b96ae6fe13157393962a8f1a9fd9 | |
| parent | 2422ceae0750c65cc1e4ea097143f4c71fbba348 (diff) | |
| download | pyramid-035d033169f48d8250afafedd0a078d3e4f62922.tar.gz pyramid-035d033169f48d8250afafedd0a078d3e4f62922.tar.bz2 pyramid-035d033169f48d8250afafedd0a078d3e4f62922.zip | |
improve code lines
| -rw-r--r-- | pyramid/config.py | 4 | ||||
| -rw-r--r-- | pyramid/tests/test_config.py | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/pyramid/config.py b/pyramid/config.py index 8e709b607..468618c92 100644 --- a/pyramid/config.py +++ b/pyramid/config.py @@ -567,8 +567,6 @@ class Configurator(object): if _context is None: _context = self._ctx = self._make_context(self.autocommit) - klass = self.__class__ - for c in callables: c = self.maybe_dotted(c) name = c.__name__ @@ -583,7 +581,7 @@ class Configurator(object): context.basepath = os.path.dirname(sourcefile) context.includepath = _context.includepath + (spec,) context.package = package_of(module) - config = klass.with_context(context) + config = self.__class__.with_context(context) wrapped = action_method(c) def wrapper(*args, **kwargs): return wrapped(config, *args, **kwargs) diff --git a/pyramid/tests/test_config.py b/pyramid/tests/test_config.py index 6b5bfbf94..3fa9b954c 100644 --- a/pyramid/tests/test_config.py +++ b/pyramid/tests/test_config.py @@ -3277,8 +3277,19 @@ class TestConfiguratorExtender(unittest.TestCase): config = self.config config.extend(dummy_extend) config2 = Configurator() - config2.extend('pyramid.tests.dummy_extend') - self.failUnless(config._ctx.extends != config2._ctx.extends) + config2.extend(dummy_extend) + self.assertEqual(config._ctx.extends, config2._ctx.extends) + + def test_extend_after_with_package(self): + from pyramid import tests + config = self.config + context_before = config._make_context() + config._ctx = context_before + config.extend(dummy_extend) + config2 = config.with_package('pyramid.tests') + self.assert_(hasattr(config2, 'dummy_extend')) + self.assertEqual(len(config._ctx.extends), 1) + self.assertEqual(config._ctx.extends, config2._ctx.extends) class TestViewDeriver(unittest.TestCase): def setUp(self): |
