diff options
| author | Michael Merickel <github@m.merickel.org> | 2018-10-04 11:31:07 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-04 11:31:07 -0500 |
| commit | c314e31223307d7fd739e0bc41519ae6d1d323d3 (patch) | |
| tree | f0d8dc769a786b59b9e44681bc0c9d694d2a0c4f | |
| parent | 684a2cb4dc39b701e357bd0cb5c683a726cfb5f8 (diff) | |
| parent | 052cb72b63b9f5a36f45a4135d1e1c05c10004dd (diff) | |
| download | pyramid-c314e31223307d7fd739e0bc41519ae6d1d323d3.tar.gz pyramid-c314e31223307d7fd739e0bc41519ae6d1d323d3.tar.bz2 pyramid-c314e31223307d7fd739e0bc41519ae6d1d323d3.zip | |
Merge branch 'master' into fix-deprecated-accept-predicate
| -rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 31 | ||||
| -rw-r--r-- | .github/ISSUE_TEMPLATE/documentation.md | 29 | ||||
| -rw-r--r-- | .github/ISSUE_TEMPLATE/feature_request.md | 24 | ||||
| -rw-r--r-- | CHANGES.rst | 16 | ||||
| -rw-r--r-- | MANIFEST.in | 2 | ||||
| -rw-r--r-- | TODO.txt | 7 | ||||
| -rw-r--r-- | contributing.md | 34 | ||||
| -rw-r--r-- | docs/api/config.rst | 1 | ||||
| -rw-r--r-- | docs/api/request.rst | 3 | ||||
| -rw-r--r-- | docs/narr/advconfig.rst | 1 | ||||
| -rw-r--r-- | docs/narr/subrequest.rst | 3 | ||||
| -rw-r--r-- | pyramid/config/factories.py | 20 | ||||
| -rw-r--r-- | pyramid/security.py | 28 | ||||
| -rw-r--r-- | pyramid/tests/test_config/test_factories.py | 60 | ||||
| -rw-r--r-- | pyramid/tests/test_security.py | 7 |
15 files changed, 116 insertions, 150 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..d6ab170f9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md new file mode 100644 index 000000000..1117a57aa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..f71d6b24e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/CHANGES.rst b/CHANGES.rst index c3049a368..3934c5aed 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -141,12 +141,16 @@ Backward Incompatibilities 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 --------------------- diff --git a/MANIFEST.in b/MANIFEST.in index 2e18ad5fe..c3391cbcc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,9 +8,11 @@ include CONTRIBUTORS.txt LICENSE.txt COPYRIGHT.txt 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 @@ -111,13 +111,6 @@ Nice-to-Have ) -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 ------------------ diff --git a/contributing.md b/contributing.md index 3b960c1e1..40c42add7 100644 --- a/contributing.md +++ b/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. - -Git Branches ------------- -Git branches and their purpose and status at the time of this writing are -listed below. +* 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. * [master](https://github.com/Pylons/pyramid/) - The branch on which further development takes place. The default branch on GitHub. @@ -34,16 +22,14 @@ listed below. 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 diff --git a/docs/api/config.rst b/docs/api/config.rst index a785b64ad..b2cd53a68 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -44,7 +44,6 @@ :methodcategory:`Extending the Request Object` .. automethod:: add_request_method - .. automethod:: set_request_property :methodcategory:`Using I18N` diff --git a/docs/api/request.rst b/docs/api/request.rst index b5700f4ab..0c169adaf 100644 --- a/docs/api/request.rst +++ b/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 diff --git a/docs/narr/advconfig.rst b/docs/narr/advconfig.rst index 880e538f1..322741648 100644 --- a/docs/narr/advconfig.rst +++ b/docs/narr/advconfig.rst @@ -299,7 +299,6 @@ These are the methods of the configurator which provide conflict detection: :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`, diff --git a/docs/narr/subrequest.rst b/docs/narr/subrequest.rst index 9094c7d83..03f372446 100644 --- a/docs/narr/subrequest.rst +++ b/docs/narr/subrequest.rst @@ -232,8 +232,7 @@ unconditionally does the following: 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 diff --git a/pyramid/config/factories.py b/pyramid/config/factories.py index 7a5b589cf..52248269d 100644 --- a/pyramid/config/factories.py +++ b/pyramid/config/factories.py @@ -1,4 +1,3 @@ -from zope.deprecation import deprecated from zope.interface import implementer from pyramid.interfaces import ( @@ -216,25 +215,6 @@ class FactoriesConfiguratorMixin(object): 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): """ Override the :app:`Pyramid` :term:`execution policy` in the diff --git a/pyramid/security.py b/pyramid/security.py index 4e9672d6a..0bdca090b 100644 --- a/pyramid/security.py +++ b/pyramid/security.py @@ -17,8 +17,6 @@ Authenticated = 'system.Authenticated' Allow = 'Allow' Deny = 'Deny' -_marker = object() - class AllPermissionsList(object): """ Stand in 'permission list' to represent all permissions """ @@ -120,7 +118,7 @@ deprecated( '"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 @@ def remember(request, userid=_marker, **kw): 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 [] diff --git a/pyramid/tests/test_config/test_factories.py b/pyramid/tests/test_config/test_factories.py index eb1f3534c..7e6ea0476 100644 --- a/pyramid/tests/test_config/test_factories.py +++ b/pyramid/tests/test_config/test_factories.py @@ -161,63 +161,3 @@ class TestFactoriesMixin(unittest.TestCase): 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) - diff --git a/pyramid/tests/test_security.py b/pyramid/tests/test_security.py index 1da73ff73..e5399ecdf 100644 --- a/pyramid/tests/test_security.py +++ b/pyramid/tests/test_security.py @@ -183,13 +183,6 @@ class TestRemember(unittest.TestCase): 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 |
