diff options
| author | Michael Merickel <michael@merickel.org> | 2019-09-18 20:03:06 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2019-09-18 20:06:32 -0500 |
| commit | 2bf1b2f11cf65ae39a1e0e8bc51937443bcaa033 (patch) | |
| tree | 78a598a38239b521c27b738813f637e63cf3a14b /src | |
| parent | 3af1883bcd617d74eb8c9b134b5ac830f8cdd2a9 (diff) | |
| download | pyramid-2bf1b2f11cf65ae39a1e0e8bc51937443bcaa033.tar.gz pyramid-2bf1b2f11cf65ae39a1e0e8bc51937443bcaa033.tar.bz2 pyramid-2bf1b2f11cf65ae39a1e0e8bc51937443bcaa033.zip | |
modify the default scan categories to be limited to only 'pyramid'
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/config/__init__.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/pyramid/config/__init__.py b/src/pyramid/config/__init__.py index 072b654c4..890d543a4 100644 --- a/src/pyramid/config/__init__.py +++ b/src/pyramid/config/__init__.py @@ -805,7 +805,12 @@ class Configurator( # this is *not* an action method (uses caller_package) def scan( - self, package=None, categories=None, onerror=None, ignore=None, **kw + self, + package=None, + categories=('pyramid',), + onerror=None, + ignore=None, + **kw ): """Scan a Python package and any of its subpackages for objects marked with :term:`configuration decoration` such as @@ -820,12 +825,12 @@ class Configurator( The ``categories`` argument, if provided, should be the :term:`Venusian` 'scan categories' to use during scanning. Providing this argument is not often necessary; specifying scan categories is - an extremely advanced usage. By default, ``categories`` is ``None`` - which will execute *all* Venusian decorator callbacks including - :app:`Pyramid`-related decorators such as - :class:`pyramid.view.view_config`. See the :term:`Venusian` - documentation for more information about limiting a scan by using an - explicit set of categories. + an extremely advanced usage. By default, ``categories`` is + ``['pyramid']`` which will execute only :app:`Pyramid`-related Venusian + decorator callbacks such as from :class:`pyramid.view.view_config`. + See the :term:`Venusian` documentation for more information about + limiting a scan by using an explicit set of categories. Pass ``None`` + to pick up *all* Venusian decorators. The ``onerror`` argument, if provided, should be a Venusian ``onerror`` callback function. The onerror function is passed to @@ -863,6 +868,10 @@ class Configurator( .. versionadded:: 1.3 The ``ignore`` argument. + .. versionchanged:: 2.0 + The ``categories`` argument now defaults to ``['pyramid']`` instead + of ``None`` to control which decorator callbacks are executed. + """ package = self.maybe_dotted(package) if package is None: # pragma: no cover |
