Steve Piercy
2017-06-10 8cbd2355d45fa6b1d6495564d0c12f646b860803
Merge remote-tracking branch 'upstream/master'
19 files modified
67 ■■■■ changed files
CHANGES.txt 4 ●●●● patch | view | raw | blame | history
CONTRIBUTORS.txt 2 ●●●●● patch | view | raw | blame | history
docs/narr/install.rst 4 ●●● patch | view | raw | blame | history
docs/quick_tour/sqla_demo/sqla_demo/models/__init__.py 2 ●●● patch | view | raw | blame | history
docs/tutorials/wiki2/definingmodels.rst 2 ●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/authentication/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/authorization/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/basiclayout/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/installation/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/models/tutorial/__init__.py 2 ●●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/models/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/tests/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
docs/tutorials/wiki2/src/views/tutorial/models/__init__.py 1 ●●●● patch | view | raw | blame | history
pyramid/authentication.py 10 ●●●●● patch | view | raw | blame | history
pyramid/scaffolds/alchemy/+package+/models/__init__.py_tmpl 1 ●●●● patch | view | raw | blame | history
pyramid/scaffolds/zodb/+package+/__init__.py 2 ●●●●● patch | view | raw | blame | history
pyramid/security.py 5 ●●●● patch | view | raw | blame | history
pyramid/tests/test_security.py 24 ●●●●● patch | view | raw | blame | history
pyramid/view.py 2 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -17,6 +17,10 @@
  invoked from ``request.invoke_exception_view``.
  See https://github.com/Pylons/pyramid/pull/3060
- Fix a bug in which ``pyramid.security.ALL_PERMISSIONS`` failed to return
  a valid iterator in its ``__iter__`` implementation.
  See https://github.com/Pylons/pyramid/pull/3074
1.9a2 (2017-05-09)
==================
CONTRIBUTORS.txt
@@ -302,3 +302,5 @@
- Jeremy(Ching-Rui) Chen, 2017/04/19
- Fang-Pen Lin, 2017/05/22
- Volker Diels-Grabsch, 2017/06/09
docs/narr/install.rst
@@ -206,9 +206,7 @@
   ``$VENV/bin/pip`` clearly specifies that ``pip`` is run from within the
   virtual environment and not at the system level.
   ``activate`` drops turds into the user's shell environment, leaving them
   vulnerable to executing commands in the wrong context. ``deactivate`` might
   not correctly restore previous shell environment variables.
   ``activate`` makes changes to the user's shell environment which can often be convenient. However, in the context of long-form documentation, environment configuration can easily be forgotten. By keeping each snippet explicit we can reduce copy / paste errors by users in which commands are executed against the wrong Python environment. Also, ``deactivate`` might not correctly restore previous shell environment variables. Avoiding ``activate`` keeps the environment more reproducible.
   Although using ``source bin/activate``, then ``pip``, requires fewer key
   strokes to issue commands once invoked, there are other things to consider.
docs/quick_tour/sqla_demo/sqla_demo/models/__init__.py
@@ -57,7 +57,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/definingmodels.rst
@@ -153,7 +153,7 @@
.. literalinclude:: src/models/tutorial/models/__init__.py
   :linenos:
   :language: py
   :emphasize-lines: 8,9
   :emphasize-lines: 10,11
Here we align our imports with the names of the models, ``Page`` and ``User``.
docs/tutorials/wiki2/src/authentication/tutorial/models/__init__.py
@@ -58,6 +58,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/src/authorization/tutorial/models/__init__.py
@@ -58,6 +58,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/src/basiclayout/tutorial/models/__init__.py
@@ -57,6 +57,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/src/installation/tutorial/models/__init__.py
@@ -57,6 +57,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/src/models/tutorial/__init__.py
@@ -5,6 +5,8 @@
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    config.include('pyramid_jinja2')
    config.include('.models')
    config.include('.routes')
docs/tutorials/wiki2/src/models/tutorial/models/__init__.py
@@ -58,6 +58,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/src/tests/tutorial/models/__init__.py
@@ -58,6 +58,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
docs/tutorials/wiki2/src/views/tutorial/models/__init__.py
@@ -58,6 +58,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
pyramid/authentication.py
@@ -1084,10 +1084,12 @@
        from pyramid.view import forbidden_view_config
        @forbidden_view_config()
        def basic_challenge(request):
            response = HTTPUnauthorized()
            response.headers.update(forget(request))
            return response
        def forbidden_view(request):
            if request.authenticated_userid is None:
                response = HTTPUnauthorized()
                response.headers.update(forget(request))
                return response
            return HTTPForbidden()
    """
    def __init__(self, check, realm='Realm', debug=False):
        self.check = check
pyramid/scaffolds/alchemy/+package+/models/__init__.py_tmpl
@@ -57,6 +57,7 @@
    """
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    # use pyramid_tm to hook the transaction lifecycle to the request
    config.include('pyramid_tm')
pyramid/scaffolds/zodb/+package+/__init__.py
@@ -12,6 +12,8 @@
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(root_factory=root_factory, settings=settings)
    settings = config.get_settings()
    settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
    config.include('pyramid_chameleon')
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.scan()
pyramid/security.py
@@ -21,10 +21,13 @@
class AllPermissionsList(object):
    """ Stand in 'permission list' to represent all permissions """
    def __iter__(self):
        return ()
        return iter(())
    def __contains__(self, other):
        return True
    def __eq__(self, other):
        return isinstance(other, self.__class__)
pyramid/tests/test_security.py
@@ -16,12 +16,32 @@
    def _makeOne(self):
        return self._getTargetClass()()
    def test_it(self):
    def test_equality_w_self(self):
        thing = self._makeOne()
        self.assertTrue(thing.__eq__(thing))
        self.assertEqual(thing.__iter__(), ())
    def test_equality_w_other_instances_of_class(self):
        thing = self._makeOne()
        other = self._makeOne()
        self.assertTrue(thing.__eq__(other))
    def test_equality_miss(self):
        thing = self._makeOne()
        other = object()
        self.assertFalse(thing.__eq__(other))
    def test_contains_w_string(self):
        thing = self._makeOne()
        self.assertTrue('anything' in thing)
    def test_contains_w_object(self):
        thing = self._makeOne()
        self.assertTrue(object() in thing)
    def test_iterable(self):
        thing = self._makeOne()
        self.assertEqual(list(thing), [])
    def test_singleton(self):
        from pyramid.security import ALL_PERMISSIONS
        self.assertEqual(ALL_PERMISSIONS.__class__, self._getTargetClass())
pyramid/view.py
@@ -668,6 +668,8 @@
        response. Otherwise the previous values for ``request.exception`` and
        ``request.exc_info`` will be restored.
        .. versionadded:: 1.7
        .. versionchanged:: 1.9
           The ``request.exception`` and ``request.exc_info`` properties will
           reflect the exception used to render the response where previously