Michael Merickel
2018-10-04 c314e31223307d7fd739e0bc41519ae6d1d323d3
Merge branch 'master' into fix-deprecated-accept-predicate
3 files added
12 files modified
264 ■■■■■ changed files
.github/ISSUE_TEMPLATE/bug_report.md 31 ●●●●● patch | view | raw | blame | history
.github/ISSUE_TEMPLATE/documentation.md 29 ●●●●● patch | view | raw | blame | history
.github/ISSUE_TEMPLATE/feature_request.md 24 ●●●●● patch | view | raw | blame | history
CHANGES.rst 16 ●●●●● patch | view | raw | blame | history
MANIFEST.in 2 ●●●●● patch | view | raw | blame | history
TODO.txt 7 ●●●●● patch | view | raw | blame | history
contributing.md 32 ●●●● patch | view | raw | blame | history
docs/api/config.rst 1 ●●●● patch | view | raw | blame | history
docs/api/request.rst 3 ●●●● patch | view | raw | blame | history
docs/narr/advconfig.rst 1 ●●●● patch | view | raw | blame | history
docs/narr/subrequest.rst 3 ●●●● patch | view | raw | blame | history
pyramid/config/factories.py 20 ●●●●● patch | view | raw | blame | history
pyramid/security.py 28 ●●●● patch | view | raw | blame | history
pyramid/tests/test_config/test_factories.py 60 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_security.py 7 ●●●●● patch | view | raw | blame | history
.github/ISSUE_TEMPLATE/bug_report.md
New file
@@ -0,0 +1,31 @@
---
name: Bug Report
about: Create a report to help us improve
---
## Get Support
To get help or technical support, see [Get Support](https://pylonsproject.org/community-support.html).
## Bug Report
Please [search the issue tracker](https://github.com/Pylons/pyramid/issues) for similar issues before submitting a new issue.
**Describe the bug**
A clear and concise description of the bug.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain the issue.
**Additional context**
Add any other context about the issue here.
.github/ISSUE_TEMPLATE/documentation.md
New file
@@ -0,0 +1,29 @@
---
name: Documentation Suggestion
about: Create an issue to improve our documentation
---
## Get Support
To get help or technical support, see [Get Support](https://pylonsproject.org/community-support.html).
## Documentation Suggestion
Please [search the issue tracker](https://github.com/Pylons/pyramid/issues) for similar issues before submitting a new issue.
**Describe the issue**
A clear and concise description of the issue.
**Include references**
1. Go to the URL '...'
2. Click on '....'
3. Scroll down to '....'
**Describe the improvement**
A clear and concise description of your suggestion.
**Screenshots**
If applicable, add screenshots to help explain the issue.
**Additional context**
Add any other context about the issue here.
.github/ISSUE_TEMPLATE/feature_request.md
New file
@@ -0,0 +1,24 @@
---
name: Feature Request
about: Suggest an idea for this project
---
## Get Support
To get help or technical support, see [Get Support](https://pylonsproject.org/community-support.html).
## Feature Request
Please [search the issue tracker](https://github.com/Pylons/pyramid/issues) for similar issues before submitting a new issue.
**Is your feature request related to an issue? Please describe.**
A clear and concise description of the issue. Example: "I'm always frustrated when [...]".
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
CHANGES.rst
@@ -141,12 +141,16 @@
  of previous ``pyramid.httpexceptions.HTTPFound``.
  See https://github.com/Pylons/pyramid/pull/3328
- Accept-handling has undergone work to get rid of undefined behaviors and
  runtime exceptions. As part of this effort, it is now a hard error to pass
  any media ranges to the ``accept`` predicate on routes and views.
  Previously, depending on the version of WebOb, this would error on certain
  requests or it would work in undefined ways.
  https://github.com/Pylons/pyramid/pull/3326
- Removed ``pyramid.config.Configurator.set_request_property`` which had been
  deprecated since Pyramid 1.5. Instead use
  ``pyramid.config.Configurator.add_request_method`` with ``reify=True`` or
  ``property=True``.
  See https://github.com/Pylons/pyramid/pull/3368
- Removed the ``principal`` keyword argument from
  ``pyramid.security.remember`` which had been deprecated since Pyramid 1.6
  and replaced by the ``userid`` argument.
  See https://github.com/Pylons/pyramid/pull/3369
Documentation Changes
---------------------
MANIFEST.in
@@ -8,9 +8,11 @@
include contributing.md RELEASING.txt
include tox.ini appveyor.yml .travis.yml rtd.txt
graft .github
include HACKING.txt hacking-tox.ini
include builddocs.sh coverage.sh scaffoldtests.sh
include TODO.txt
global-exclude __pycache__ *.py[cod]
global-exclude .DS_Store
TODO.txt
@@ -111,13 +111,6 @@
         )
 
Future
------
- 1.9: Remove set_request_property.
- 1.9: Remove extra code enabling ``pyramid.security.remember(principal=...)``
  and force use of ``userid``.
Probably Bad Ideas
------------------
contributing.md
@@ -1,28 +1,16 @@
Contributing
============
# Contributing
All projects under the Pylons Projects, including this one, follow the
guidelines established at [How to
Contribute](https://pylonsproject.org/community-how-to-contribute.html) and
[Coding Style and
Standards](https://pylonsproject.org/community-coding-style-standards.html).
All projects under the Pylons Projects, including this one, follow the guidelines established at [How to Contribute](https://pylonsproject.org/community-how-to-contribute.html), [Coding Style and Standards](https://pylonsproject.org/community-coding-style-standards.html), and [Pylons Project Documentation Style Guide](https://docs.pylonsproject.org/projects/docs-style-guide/).
You can contribute to this project in several ways.
* [File an Issue on GitHub](https://github.com/Pylons/pyramid/issues)
* Fork this project and create a branch with your suggested change. When ready,
  submit a pull request for consideration. [GitHub
  Flow](https://guides.github.com/introduction/flow/index.html) describes the
  workflow process and why it's a good practice. When submitting a pull
  request, sign
  [CONTRIBUTORS.txt](https://github.com/Pylons/pyramid/blob/master/CONTRIBUTORS.txt)
  if you have not yet done so.
* Join the IRC channel #pyramid on irc.freenode.net.
* Fork this project and create a branch with your suggested change. When ready, submit a pull request for consideration. [GitHub Flow](https://guides.github.com/introduction/flow/index.html) describes the workflow process and why it's a good practice. When submitting a pull request, sign [CONTRIBUTORS.txt](https://github.com/Pylons/pyramid/blob/master/CONTRIBUTORS.txt) if you have not yet done so.
* Join the [IRC channel #pyramid on irc.freenode.net](https://webchat.freenode.net/?channels=pyramid).
Git Branches
------------
Git branches and their purpose and status at the time of this writing are
listed below.
## Git Branches
Git branches and their purpose and status at the time of this writing are listed below.
* [master](https://github.com/Pylons/pyramid/) - The branch on which further
  development takes place. The default branch on GitHub.
@@ -34,16 +22,14 @@
Older branches are not actively maintained. In general, two stable branches and
one or two development branches are actively maintained.
Prerequisites
-------------
## Prerequisites
Follow the instructions in HACKING.txt for your version or branch located in
the [root of the Pyramid repository](https://github.com/Pylons/pyramid/) to
install Pyramid and the tools needed to run its tests and build its
documentation.
Building documentation for a Pylons Project project
---------------------------------------------------
## Building documentation for a Pylons Project project
*Note:* These instructions might not work for Windows users. Suggestions to
improve the process for Windows users are welcome by submitting an issue or a
docs/api/config.rst
@@ -44,7 +44,6 @@
   :methodcategory:`Extending the Request Object`
     .. automethod:: add_request_method
     .. automethod:: set_request_property
   :methodcategory:`Using I18N`
docs/api/request.rst
@@ -228,8 +228,7 @@
        handed.
      - sets request extensions (such as those added via
        :meth:`~pyramid.config.Configurator.add_request_method` or
        :meth:`~pyramid.config.Configurator.set_request_property`) on the
        :meth:`~pyramid.config.Configurator.add_request_method`) on the
        request it's passed.
      - causes a :class:`~pyramid.events.NewRequest` event to be sent at the
docs/narr/advconfig.rst
@@ -299,7 +299,6 @@
:meth:`~pyramid.config.Configurator.add_request_method`,
:meth:`~pyramid.config.Configurator.set_request_factory`,
:meth:`~pyramid.config.Configurator.set_session_factory`,
:meth:`~pyramid.config.Configurator.set_request_property`,
:meth:`~pyramid.config.Configurator.set_root_factory`,
:meth:`~pyramid.config.Configurator.set_view_mapper`,
:meth:`~pyramid.config.Configurator.set_authentication_policy`,
docs/narr/subrequest.rst
@@ -232,8 +232,7 @@
  callable) to the request object to which it is handed.
- It sets request extensions (such as those added via
  :meth:`~pyramid.config.Configurator.add_request_method` or
  :meth:`~pyramid.config.Configurator.set_request_property`) on the subrequest
  :meth:`~pyramid.config.Configurator.add_request_method`) on the subrequest
  object passed as ``request``.
- It causes a :class:`~pyramid.events.NewRequest` event to be sent at the
pyramid/config/factories.py
@@ -1,4 +1,3 @@
from zope.deprecation import deprecated
from zope.interface import implementer
from pyramid.interfaces import (
@@ -214,25 +213,6 @@
            intr['reify'] = False
            self.action(('request extensions', name), register,
                        introspectables=(intr,))
    @action_method
    def set_request_property(self, callable, name=None, reify=False):
        """ Add a property to the request object.
        .. deprecated:: 1.5
            :meth:`pyramid.config.Configurator.add_request_method` should be
            used instead.  (This method was docs-deprecated in 1.4 and
            issues a real deprecation warning in 1.5).
        .. versionadded:: 1.3
        """
        self.add_request_method(
            callable, name=name, property=not reify, reify=reify)
    deprecated(
        set_request_property,
        'set_request_propery() is deprecated as of Pyramid 1.5; use '
        'add_request_method() with the property=True argument instead')
    @action_method
    def set_execution_policy(self, policy):
pyramid/security.py
@@ -17,8 +17,6 @@
Allow = 'Allow'
Deny = 'Deny'
_marker = object()
class AllPermissionsList(object):
    """ Stand in 'permission list' to represent all permissions """
@@ -120,7 +118,7 @@
    '"effective_principals" attribute of the Pyramid request instead.'
    )
def remember(request, userid=_marker, **kw):
def remember(request, userid, **kw):
    """
    Returns a sequence of header tuples (e.g. ``[('Set-Cookie', 'foo=abc')]``)
    on this request's response.
@@ -143,24 +141,14 @@
    always return an empty sequence. If used, the composition and
    meaning of ``**kw`` must be agreed upon by the calling code and
    the effective authentication policy.
    .. deprecated:: 1.6
        Renamed the ``principal`` argument to ``userid`` to clarify its
        purpose.
    .. versionchanged:: 1.6
        Deprecated the ``principal`` argument in favor of ``userid`` to clarify
        its relationship to the authentication policy.
    .. versionchanged:: 1.10
        Removed the deprecated ``principal`` argument.
    """
    if userid is _marker:
        principal = kw.pop('principal', _marker)
        if principal is _marker:
            raise TypeError(
                'remember() missing 1 required positional argument: '
                '\'userid\'')
        else:
            deprecated(
                'principal',
                'The "principal" argument was deprecated in Pyramid 1.6. '
                'It will be removed in Pyramid 1.9. Use the "userid" '
                'argument instead.')
            userid = principal
    policy = _get_authentication_policy(request)
    if policy is None:
        return []
pyramid/tests/test_config/test_factories.py
@@ -161,63 +161,3 @@
        registry = config.registry
        result = registry.queryUtility(IExecutionPolicy)
        self.assertEqual(result, default_execution_policy)
class TestDeprecatedFactoriesMixinMethods(unittest.TestCase):
    def setUp(self):
        from zope.deprecation import __show__
        __show__.off()
    def tearDown(self):
        from zope.deprecation import __show__
        __show__.on()
    def _makeOne(self, *arg, **kw):
        from pyramid.config import Configurator
        config = Configurator(*arg, **kw)
        return config
    def test_set_request_property_with_callable(self):
        from pyramid.interfaces import IRequestExtensions
        config = self._makeOne(autocommit=True)
        callable = lambda x: None
        config.set_request_property(callable, name='foo')
        exts = config.registry.getUtility(IRequestExtensions)
        self.assertTrue('foo' in exts.descriptors)
    def test_set_request_property_with_unnamed_callable(self):
        from pyramid.interfaces import IRequestExtensions
        config = self._makeOne(autocommit=True)
        def foo(self): pass
        config.set_request_property(foo, reify=True)
        exts = config.registry.getUtility(IRequestExtensions)
        self.assertTrue('foo' in exts.descriptors)
    def test_set_request_property_with_property(self):
        from pyramid.interfaces import IRequestExtensions
        config = self._makeOne(autocommit=True)
        callable = property(lambda x: None)
        config.set_request_property(callable, name='foo')
        exts = config.registry.getUtility(IRequestExtensions)
        self.assertTrue('foo' in exts.descriptors)
    def test_set_multiple_request_properties(self):
        from pyramid.interfaces import IRequestExtensions
        config = self._makeOne()
        def foo(self): pass
        bar = property(lambda x: None)
        config.set_request_property(foo, reify=True)
        config.set_request_property(bar, name='bar')
        config.commit()
        exts = config.registry.getUtility(IRequestExtensions)
        self.assertTrue('foo' in exts.descriptors)
        self.assertTrue('bar' in exts.descriptors)
    def test_set_multiple_request_properties_conflict(self):
        from pyramid.exceptions import ConfigurationConflictError
        config = self._makeOne()
        def foo(self): pass
        bar = property(lambda x: None)
        config.set_request_property(foo, name='bar', reify=True)
        config.set_request_property(bar, name='bar')
        self.assertRaises(ConfigurationConflictError, config.commit)
pyramid/tests/test_security.py
@@ -183,13 +183,6 @@
        result = self._callFUT(request, 'me')
        self.assertEqual(result, [('X-Pyramid-Test', 'me')])
    def test_with_deprecated_principal_arg(self):
        request = _makeRequest()
        registry = request.registry
        _registerAuthenticationPolicy(registry, 'yo')
        result = self._callFUT(request, principal='me')
        self.assertEqual(result, [('X-Pyramid-Test', 'me')])
    def test_with_missing_arg(self):
        request = _makeRequest()
        registry = request.registry