Chris McDonough
2012-02-09 e4b8fa632c5d2b020e168f4efe3d7c00049a279f
Features
--------

- The ``scan`` method of a ``Configurator`` can be passed an ``ignore``
argument, which can be a string, a callable, or a list consisting of
strings and/or callables. This feature allows submodules, subpackages, and
global objects from being scanned. See
http://readthedocs.org/docs/venusian/en/latest/#ignore-scan-argument for
more information about how to use the ``ignore`` argument to ``scan``.

Dependencies
------------

- Depend on ``venusian`` >= 1.0a3 to provide scan ``ignore`` support.
6 files modified
73 ■■■■■ changed files
CHANGES.txt 18 ●●●●● patch | view | raw | blame | history
docs/whatsnew-1.3.rst 7 ●●●●● patch | view | raw | blame | history
pyramid/config/__init__.py 21 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_config/test_init.py 22 ●●●●● patch | view | raw | blame | history
setup.py 2 ●●● patch | view | raw | blame | history
tox.ini 3 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -1,3 +1,21 @@
Next release
============
Features
--------
- The ``scan`` method of a ``Configurator`` can be passed an ``ignore``
  argument, which can be a string, a callable, or a list consisting of
  strings and/or callables.  This feature allows submodules, subpackages, and
  global objects from being scanned.  See
  http://readthedocs.org/docs/venusian/en/latest/#ignore-scan-argument for
  more information about how to use the ``ignore`` argument to ``scan``.
Dependencies
------------
- Depend on ``venusian`` >= 1.0a3 to provide scan ``ignore`` support.
1.3a7 (2012-02-07)
==================
docs/whatsnew-1.3.rst
@@ -252,6 +252,13 @@
  http://www.python.org/dev/peps/pep-0333/#optional-platform-specific-file-handling)
  when one is provided by the web server.
- The :meth:`pyramid.config.Configurator.scan` method can be passed an
  ``ignore`` argument, which can be a string, a callable, or a list
  consisting of strings and/or callables.  This feature allows submodules,
  subpackages, and global objects from being scanned.  See
  http://readthedocs.org/docs/venusian/en/latest/#ignore-scan-argument for
  more information about how to use the ``ignore`` argument to ``scan``.
Backwards Incompatibilities
---------------------------
pyramid/config/__init__.py
@@ -851,7 +851,8 @@
        return self.manager.pop()
    # this is *not* an action method (uses caller_package)
    def scan(self, package=None, categories=None, onerror=None, **kw):
    def scan(self, package=None, categories=None, onerror=None, ignore=None,
             **kw):
        """Scan a Python package and any of its subpackages for objects
        marked with :term:`configuration decoration` such as
        :class:`pyramid.view.view_config`.  Any decorated object found will
@@ -879,6 +880,20 @@
        :term:`Venusian` documentation for more information about ``onerror``
        callbacks.
        The ``ignore`` argument, if provided, should be a Venusian ``ignore``
        value.  Providing an ``ignore`` argument allows the scan to ignore
        particular modules, packages, or global objects during a scan.
        ``ignore`` can be a string or a callable, or a list containing
        strings or callables.  The simplest usage of ``ignore`` is to provide
        a module or package by providing a full path to its dotted name.  For
        example: ``config.scan(ignore='my.module.subpackage')`` would ignore
        the ``my.module.subpackage`` package during a scan, which would
        prevent the subpackage and any of its submodules from being imported
        and scanned.  See the :term:`Venusian` documentation for more
        information about the ``ignore`` argument.
        .. note:: the ``ignore`` argument is new in Pyramid 1.3.
        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.
        The ``kw`` argument represents a set of keyword arguments to pass to
        the Venusian ``Scanner`` object's constructor.  See the
@@ -900,7 +915,9 @@
        ctorkw.update(kw)
        scanner = self.venusian.Scanner(**ctorkw)
        scanner.scan(package, categories=categories, onerror=onerror)
        scanner.scan(package, categories=categories, onerror=onerror,
                     ignore=ignore)
    def make_wsgi_app(self):
        """ Commits any pending configuration statements, sends a
pyramid/tests/test_config/test_init.py
@@ -929,6 +929,28 @@
        result = render_view_to_response(ctx, req, 'pod_notinit')
        self.assertEqual(result, None)
    def test_scan_integration_with_ignore(self):
        from zope.interface import alsoProvides
        from pyramid.interfaces import IRequest
        from pyramid.view import render_view_to_response
        import pyramid.tests.test_config.pkgs.scannable as package
        config = self._makeOne(autocommit=True)
        config.scan(package,
                    ignore='pyramid.tests.test_config.pkgs.scannable.another')
        ctx = DummyContext()
        req = DummyRequest()
        alsoProvides(req, IRequest)
        req.registry = config.registry
        req.method = 'GET'
        result = render_view_to_response(ctx, req, '')
        self.assertEqual(result, 'grokked')
        # ignored
        v = render_view_to_response(ctx, req, 'another_stacked_class2')
        self.assertEqual(v, None)
    def test_scan_integration_dottedname_package(self):
        from zope.interface import alsoProvides
        from pyramid.interfaces import IRequest
setup.py
@@ -37,7 +37,7 @@
    'repoze.lru >= 0.4', # py3 compat
    'zope.interface >= 3.8.0',  # has zope.interface.registry
    'zope.deprecation >= 3.5.0', # py3 compat
    'venusian >= 1.0a1', # ``onerror``
    'venusian >= 1.0a3', # ``ignore``
    'translationstring >= 0.4', # py3 compat
    'PasteDeploy >= 1.5.0', # py3 compat
    ]
tox.ini
@@ -11,6 +11,7 @@
    repoze.sphinx.autointerface
    WebTest
    virtualenv
    venusian>=1.0a3
[testenv:py32]
commands = 
@@ -18,6 +19,7 @@
deps =
    WebTest
    virtualenv
    venusian>=1.0a3
[testenv:cover]
basepython =
@@ -30,6 +32,7 @@
    WebTest
    repoze.sphinx.autointerface
    virtualenv
    venusian>=1.0a3
    nose
    coverage==3.4
    nosexcover