diff options
| author | Chris McDonough <chrism@plope.com> | 2010-12-15 15:50:21 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-12-15 15:50:21 -0500 |
| commit | c5d172481e1e95bf4c8811ec9d1b34f6792fa63a (patch) | |
| tree | afe95493960dc6f13501a0dc650aa54c02f2cd08 | |
| parent | 4178808031c2b4aac3af65631ab6651f730de48b (diff) | |
| download | pyramid-c5d172481e1e95bf4c8811ec9d1b34f6792fa63a.tar.gz pyramid-c5d172481e1e95bf4c8811ec9d1b34f6792fa63a.tar.bz2 pyramid-c5d172481e1e95bf4c8811ec9d1b34f6792fa63a.zip | |
- 1.0a5 introduced a bug when ``pyramid.config.Configurator.scan`` was used.
The symptoms were: lots of deprecation warnings printed to the console
about imports of deprecated Pyramid functions and classes and non-detection
of views decorated with ``view_config`` decorators. This has now been
fixed. Closes #68.
| -rw-r--r-- | CHANGES.txt | 9 | ||||
| -rw-r--r-- | pyramid/config.py | 2 | ||||
| -rw-r--r-- | pyramid/tests/selfscanapp/__init__.py | 11 | ||||
| -rw-r--r-- | pyramid/tests/selfscanapp/another.py | 6 | ||||
| -rw-r--r-- | pyramid/tests/test_integration.py | 20 |
5 files changed, 47 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 4e4b4f771..1e63e67e6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,15 @@ Next release ============ +Bug Fixes +--------- + +- 1.0a5 introduced a bug when ``pyramid.config.Configurator.scan`` was used. + The symptoms were: lots of deprecation warnings printed to the console + about imports of deprecated Pyramid functions and classes and non-detection + of views decorated with ``view_config`` decorators. This has now been + fixed. + 1.0a5 (2010-12-14) ================== diff --git a/pyramid/config.py b/pyramid/config.py index 1c6d1878c..58e2550da 100644 --- a/pyramid/config.py +++ b/pyramid/config.py @@ -1790,7 +1790,7 @@ class Configurator(object): self.registry.registerUtility(mapper, IRoutesMapper) return mapper - @action_method + # this is *not* an action method (uses caller_package) def scan(self, package=None, categories=None): """ Scan a Python package and any of its subpackages for objects marked with :term:`configuration decoration` such as diff --git a/pyramid/tests/selfscanapp/__init__.py b/pyramid/tests/selfscanapp/__init__.py new file mode 100644 index 000000000..779ea3eed --- /dev/null +++ b/pyramid/tests/selfscanapp/__init__.py @@ -0,0 +1,11 @@ +from pyramid.view import view_config + +@view_config(renderer='string') +def abc(request): + return 'root' + +def main(): + from pyramid.config import Configurator + c = Configurator() + c.scan() + return c diff --git a/pyramid/tests/selfscanapp/another.py b/pyramid/tests/selfscanapp/another.py new file mode 100644 index 000000000..a30ad3297 --- /dev/null +++ b/pyramid/tests/selfscanapp/another.py @@ -0,0 +1,6 @@ +from pyramid.view import view_config + +@view_config(name='two', renderer='string') +def two(request): + return 'two' + diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index 2c8892eef..971c4832e 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -267,6 +267,26 @@ class ImperativeIncludeConfigurationTest(unittest.TestCase): res = self.testapp.get('/three', status=200) self.failUnless('three' in res.body) +class SelfScanAppTest(unittest.TestCase): + def setUp(self): + from pyramid.tests.selfscanapp import main + config = main() + app = config.make_wsgi_app() + from webtest import TestApp + self.testapp = TestApp(app) + self.config = config + + def tearDown(self): + self.config.end() + + def test_root(self): + res = self.testapp.get('/', status=200) + self.failUnless('root' in res.body) + + def test_two(self): + res = self.testapp.get('/two', status=200) + self.failUnless('two' in res.body) + class DummyContext(object): pass |
