diff options
| author | Chris McDonough <chrism@plope.com> | 2011-04-22 13:59:29 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-04-22 13:59:29 -0400 |
| commit | a7e3486de4030de722c795552d7f8193344b06bf (patch) | |
| tree | 6aadcabf2b2588037d29c0cc36b68cc7ea31cf2f | |
| parent | 1440e9828fcd527ff79de0655ee65d3076f13911 (diff) | |
| download | pyramid-a7e3486de4030de722c795552d7f8193344b06bf.tar.gz pyramid-a7e3486de4030de722c795552d7f8193344b06bf.tar.bz2 pyramid-a7e3486de4030de722c795552d7f8193344b06bf.zip | |
test coverage
| -rw-r--r-- | pyramid/compat/__init__.py | 9 | ||||
| -rw-r--r-- | pyramid/config.py | 5 | ||||
| -rw-r--r-- | pyramid/tests/test_config.py | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/pyramid/compat/__init__.py b/pyramid/compat/__init__.py index 8bbf79703..096fb3ddf 100644 --- a/pyramid/compat/__init__.py +++ b/pyramid/compat/__init__.py @@ -146,3 +146,12 @@ except ImportError: # pragma: no cover import md5 md5 = md5.new +try: + any = any # make importable +except NameError: # pragma: no cover + def any(L): + for thing in L: + if thing: + return True + return False + diff --git a/pyramid/config.py b/pyramid/config.py index eedb6ad9f..0041a6726 100644 --- a/pyramid/config.py +++ b/pyramid/config.py @@ -51,6 +51,7 @@ from pyramid import renderers from pyramid.authorization import ACLAuthorizationPolicy from pyramid.compat import all from pyramid.compat import md5 +from pyramid.compat import any from pyramid.events import ApplicationCreated from pyramid.exceptions import ConfigurationError from pyramid.exceptions import Forbidden @@ -1770,8 +1771,8 @@ class Configurator(object): self.add_view(**info) # deprecated adding views from add_route - if view or view_context or view_permission or view_renderer or \ - view_for or for_ or permission or renderer or view_attr: + if any([view, view_context, view_permission, view_renderer, + view_for, for_, permission, renderer, view_attr]): self._add_view_from_route( route_name=name, view=view, diff --git a/pyramid/tests/test_config.py b/pyramid/tests/test_config.py index 578965702..560f68f95 100644 --- a/pyramid/tests/test_config.py +++ b/pyramid/tests/test_config.py @@ -3018,7 +3018,6 @@ class TestConfiguratorDeprecatedFeatures(unittest.TestCase): def _getViewCallable(self, config, ctx_iface=None, request_iface=None, name='', exception_view=False): from zope.interface import Interface - from pyramid.interfaces import IRequest from pyramid.interfaces import IView from pyramid.interfaces import IViewClassifier from pyramid.interfaces import IExceptionViewClassifier @@ -3028,8 +3027,6 @@ class TestConfiguratorDeprecatedFeatures(unittest.TestCase): classifier = IViewClassifier if ctx_iface is None: ctx_iface = Interface - if request_iface is None: - request_iface = IRequest return config.registry.adapters.lookup( (classifier, request_iface, ctx_iface), IView, name=name, default=None) |
