Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Pylons/pyramid
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Sep 9, 2013
2 parents 7a73e56 + 26787cf commit 7ef0c25
Show file tree
Hide file tree
Showing 128 changed files with 650 additions and 4,442 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ python:
- pypy
- 3.2

script: python setup.py test
script: python setup.py test -q

notifications:
email:
Expand Down
114 changes: 114 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,117 @@
Next Release
============

Features
--------

- Users can now provide dotted Python names to as the ``factory`` argument
the Configurator methods named ``add_{view,route,subscriber}_predicate``
(instead of passing the predicate factory directly, you can pass a
dotted name which refers to the factory).

Bug Fixes
---------

- Fix an exception in ``pyramid.path.package_name`` when resolving the package
name for namespace packages that had no ``__file__`` attribute.

Backwards Incompatibilities
---------------------------

- Pyramid has dropped native support for the Mako and Chameleon renderers. To
re-add support for these renderers into existing projects there are 3 steps:

- Add `pyramid_mako` and/or `pyramid_chameleon` as dependencies by
adding them to the `install_requires` section of the package's `setup.py`::

setup(
#...
install_requires=[
'pyramid_mako', # new dependency
'pyramid_chameleon', # new dependency
'pyramid',
#...
],
)

- Update instances of the ``pyramid.config.Configurator`` to include the
required addons::

config.include('pyramid_chameleon')
config.include('pyramid_mako')

- If any unit tests are invoking either ``pyramid.renderers.render()`` or
``pyramid.renderers.render_to_response()`` with either Mako or Chameleon
templates then the ``pyramid.config.Configurator`` instance at the root of
the unit test should be also be updated to include the addons, as shown
above. For example::

config = pyramid.testing.setUp()
config.include('pyramid_mako')

result = pyramid.renderers.render('mypkg:templates/home.mako', {})

- Removed the ``request.response_*`` varying attributes. These attributes
have been deprecated since Pyramid 1.1, and as per the deprecation policy,
have now been removed.

- ``request.response`` will no longer be mutated when using the
``pyramid.renderers.render()`` API. Almost all renderers mutate the
``request.response`` response object (for example, the JSON renderer sets
``request.response.content_type`` to ``application/json``), but this is
only necessary when the renderer is generating a response; it was a bug
when it was done as a side effect of calling ``pyramid.renderers.render()``.

- The Mako and Chameleon renderers have been removed from Pyramid. Their
functionality has been moved to the ``pyramid_mako`` and
``pyramid_chameleon`` distributions respectively.

- Removed the ``bfg2pyramid`` fixer script.

- The ``pyramid.events.NewResponse`` event is now sent **after** response
callbacks are executed. It previously executed before response callbacks
were executed. Rationale: it's more useful to be able to inspect the response
after response callbacks have done their jobs instead of before.

- Removed the class named ``pyramid.view.static`` that had been deprecated
since Pyramid 1.1. Instead use ``pyramid.static.static_view`` with
``use_subpath=True`` argument.

- Removed the ``pyramid.view.is_response`` function that had been deprecated
since Pyramid 1.1. Use the ``pyramid.request.Request.is_response`` method
instead.

- Removed the ability to pass the following arguments to
``pyramid.config.Configurator.add_route``: `view``, ``view_context``.
``view_for``, ``view_permission``, ``view_renderer``, and ``view_attr``.
Using these arguments had been deprecated since Pyramid 1.1. Instead of
passing view-related arguments to ``add_route``, use a separate call to
``pyramid.config.Configurator.add_view`` to associate a view with a route
using its ``route_name`` argument. Note that this impacts the
``pyramid.config.Configurator.add_static_view`` function too, because it
delegates to ``add_route``.

- Removed the ability to influence and query a ``pyramid.request.Request``
object as if it were a dictionary. Previously it was possible to use methods
like ``__getitem__``, ``get``, ``items``, and other dictlike methods to
access values in the WSGI environment. This behavior had been deprecated
since Pyramid 1.1. Use methods of ``request.environ`` (a real dictionary)
instead.

- Removed ancient backwards compatibily hack in
``pyramid.traversal.DefaultRootFactory`` which populated the ``__dict__`` of
the factory with the matchdict values for compatibility with BFG 0.9.

- The ``renderer_globals_factory`` argument to the
``pyramid.config.Configurator` constructor and its ``setup_registry`` method
has been removed. The ``set_renderer_globals_factory`` method of
``pyramid.config.Configurator`` has also been removed. The (internal)
``pyramid.interfaces.IRendererGlobals`` interface was also removed. These
arguments, methods and interfaces had been deprecated since 1.1. Use a
``BeforeRender`` event subscriber as documented in the "Hooks" chapter of the
Pyramid narrative documentation instead of providing renderer globals values
to the configurator.

1.5a1 (2013-08-30)
==================

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,5 @@ Contributors
- Matthew Wilkes, 2013/08/23

- Takahiro Fujiwara, 2013/08/28

- Doug Hellmann, 2013/09/06
16 changes: 10 additions & 6 deletions HACKING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ In order to add a feature to Pyramid:
documentation (in ``docs/``).

- The feature must work fully on the following CPython versions: 2.6,
2.7, and 3.2 on both UNIX and Windows.
2.7, 3.2, and 3.3 on both UNIX and Windows.

- The feature must work on the latest version of PyPy.

Expand All @@ -104,21 +104,25 @@ Coding Style

- PEP8 compliance. Whitespace rules are relaxed: not necessary to put
2 newlines between classes. But 80-column lines, in particular, are
mandatory.
mandatory. See
http://docs.pylonsproject.org/en/latest/community/codestyle.html for more
information.

- Please do not remove trailing whitespace. Configure your editor to reduce
diff noise. See https://github.com/Pylons/pyramid/issues/788 for more.

Running Tests
--------------

- To run all tests for Pyramid on a single Python version, run ``nosetests`` from
your development virtualenv (See *Using a Development Checkout* above).
- To run all tests for Pyramid on a single Python version, run ``nosetests``
from your development virtualenv (See *Using a Development Checkout* above).

- To run individual tests (i.e. during development) you can use a regular
expression with the ``-t`` parameter courtesy of the `nose-selecttests
<https://pypi.python.org/pypi/nose-selecttests/>`_ plugin that's been installed (along with nose itself) via ``python setup.py dev``. The easiest usage is to
simply provide the verbatim name of the test you're working on.
<https://pypi.python.org/pypi/nose-selecttests/>`_ plugin that's been
installed (along with nose itself) via ``python setup.py dev``. The
easiest usage is to simply provide the verbatim name of the test you're
working on.

- To run the full set of Pyramid tests on all platforms, install ``tox``
(http://codespeak.net/~hpk/tox/) into a system Python. The ``tox`` console
Expand Down
18 changes: 3 additions & 15 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ Nice-to-Have

- Have action methods return their discriminators.

- Fix renderers chapter to better document system values passed to template
renderers.

- Modify view mapper narrative docs to not use pyramid_handlers.

- Modify the urldispatch chapter examples to assume a scan rather than
Expand Down Expand Up @@ -121,21 +118,12 @@ Nice-to-Have
Future
------

- 1.5: remove ``pyramid.view.static`` and ``pyramid.view.is_response``.

- 1.5: turn ``pyramid.settings.Settings`` into a function that returns the
original dict (after ``__getattr__`` deprecation period, it was deprecated
in 1.2).

- 1.5: Remove ``pyramid.requests.DeprecatedRequestMethodsMixin`` and code in
renderers module that looks for _response_content_type, et. al.

- 1.5: Maybe? deprecate set_request_property in favor of pointing people at
add_request_method, schedule removal for 1.8?

- 1.5: Remove pyramid.config.rendering set_renderer_globals_factory maybe.

- 1.5: remove pyramid.config.route _add_view_from_route function.
- 1.6: turn ``pyramid.settings.Settings`` into a function that returns the
original dict (after ``__getattr__`` deprecation period, it was deprecated
in 1.2).

- 1.6: Remove IContextURL and TraversalContextURL.

Expand Down
4 changes: 0 additions & 4 deletions docs/api/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@

.. automethod:: override_asset(to_override, override_with)

:methodcategory:`Setting Renderer Globals`

.. automethod:: set_renderer_globals_factory(factory)

:methodcategory:`Getting and Adding Settings`

.. automethod:: add_settings
Expand Down
24 changes: 3 additions & 21 deletions docs/api/request.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@
- Ensures that the user implied by the request passed has the necessary
authorization to invoke view callable before calling it.

- causes a :class:`~pyramid.events.NewResponse` event to be sent when
the Pyramid application returns a response.

- Calls any :term:`response callback` functions defined within the
request's lifetime if a response is obtained from the Pyramid
application.

- causes a :class:`~pyramid.events.NewResponse` event to be sent if a
response is obtained.

- Calls any :term:`finished callback` functions defined within the
request's lifetime.

Expand Down Expand Up @@ -235,24 +235,6 @@

.. automethod:: resource_path

.. attribute:: response_*

In Pyramid 1.0, you could set attributes on a
:class:`pyramid.request.Request` which influenced the behavior of
*rendered* responses (views which use a :term:`renderer` and which
don't directly return a response). These attributes began with
``response_``, such as ``response_headerlist``. If you needed to
influence response values from a view that uses a renderer (such as the
status code, a header, the content type, etc) you would set these
attributes. See :ref:`response_prefixed_attrs` for further discussion.
As of Pyramid 1.1, assignment to ``response_*`` attrs is deprecated.
Assigning to one is still supported but will cause a deprecation
warning to be emitted, and eventually the feature will be removed. For
new code, instead of assigning ``response_*`` attributes to the
request, use API of the :attr:`pyramid.request.Request.response`
object (exposed to view code as ``request.response``) to influence
rendered response behavior.

.. attribute:: json_body

This property will return the JSON-decoded variant of the request
Expand Down
6 changes: 0 additions & 6 deletions docs/api/view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

.. autofunction:: render_view

.. autofunction:: is_response

.. autoclass:: view_config
:members:

Expand All @@ -25,8 +23,4 @@
.. autoclass:: forbidden_view_config
:members:

.. autoclass:: static
:members:
:inherited-members:


7 changes: 3 additions & 4 deletions docs/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,8 @@ Glossary
:term:`Internationalization`.

renderer globals
Values injected as names into a renderer based on application
policy. See :ref:`adding_renderer_globals` for more
information.
Values injected as names into a renderer by a
:class:`pyramid.event.BeforeRender` event.

response callback
A user-defined callback executed by the :term:`router` at a
Expand Down Expand Up @@ -1021,4 +1020,4 @@ Glossary
add-on
A Python :term:`distribution` that uses Pyramid's extensibility
to plug into a Pyramid application and provide extra,
configurable services.
configurable services.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ After you install :app:`Pyramid` and run this application, when you visit
See :ref:`firstapp_chapter` for a full explanation of how this application
works. Read the :ref:`html_narrative_documentation` to understand how
:app:`Pyramid` is designed to scale from simple applications like this to
very large web applications.
very large web applications. To just dive in headfirst, read the
:doc:`quick_tour`.

Front Matter
============
Expand Down Expand Up @@ -126,7 +127,6 @@ platforms.

tutorials/wiki2/index.rst
tutorials/wiki/index.rst
tutorials/bfg/index.rst
tutorials/modwsgi/index.rst

.. _html_api_documentation:
Expand Down
1 change: 0 additions & 1 deletion docs/latexindex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ Tutorials

tutorials/wiki2/index.rst
tutorials/wiki/index.rst
tutorials/bfg/index.rst
tutorials/modwsgi/index.rst

.. _api_documentation:
Expand Down
1 change: 1 addition & 0 deletions docs/narr/MyProject/myproject/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.include('pyramid_chameleon')
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.scan()
Expand Down
1 change: 1 addition & 0 deletions docs/narr/MyProject/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'waitress',
]
Expand Down
1 change: 0 additions & 1 deletion docs/narr/advconfig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ These are the methods of the configurator which provide conflict detection:
:meth:`~pyramid.config.Configurator.set_view_mapper`,
:meth:`~pyramid.config.Configurator.set_authentication_policy`,
:meth:`~pyramid.config.Configurator.set_authorization_policy`,
:meth:`~pyramid.config.Configurator.set_renderer_globals_factory`,
:meth:`~pyramid.config.Configurator.set_locale_negotiator`,
:meth:`~pyramid.config.Configurator.set_default_permission`,
:meth:`~pyramid.config.Configurator.add_traverser`,
Expand Down
Loading

0 comments on commit 7ef0c25

Please sign in to comment.