Merge branch 'master' into fix-deprecated-accept-predicate
3 files added
12 files modified
New file |
| | |
| | | --- |
| | | 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. |
New file |
| | |
| | | --- |
| | | 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. |
New file |
| | |
| | | --- |
| | | 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. |
| | |
| | | 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 |
| | | --------------------- |
| | |
| | | |
| | | 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 |
| | |
| | | ) |
| | | |
| | | |
| | | 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 |
| | | ============ |
| | | # 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. |
| | |
| | | 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 |
| | |
| | | :methodcategory:`Extending the Request Object` |
| | | |
| | | .. automethod:: add_request_method |
| | | .. automethod:: set_request_property |
| | | |
| | | :methodcategory:`Using I18N` |
| | | |
| | |
| | | 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 |
| | |
| | | :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`, |
| | |
| | | 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 |
| | |
| | | from zope.deprecation import deprecated |
| | | from zope.interface import implementer |
| | | |
| | | from pyramid.interfaces import ( |
| | |
| | | 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): |
| | |
| | | Allow = 'Allow' |
| | | Deny = 'Deny' |
| | | |
| | | _marker = object() |
| | | |
| | | class AllPermissionsList(object): |
| | | """ Stand in 'permission list' to represent all permissions """ |
| | | |
| | |
| | | '"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. |
| | |
| | | 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 [] |
| | |
| | | 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) |
| | | |
| | |
| | | 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 |