Navigation

This article explains the new features in Pyramid version 1.6 as
compared to its predecessor, Pyramid 1.5. It also documents backwards
incompatibilities between the two versions and deprecations added to
Pyramid 1.6, as well as software dependency changes and notable
documentation additions.

IPython and BPython support have been removed from pshell in the core. To
continue using them on Pyramid 1.6+, you must install the binding packages
explicitly. One way to do this is by adding pyramid_ipython (or
pyramid_bpython) to the install_requires section of your package's
setup.py file, then re-running setup.pydevelop:

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

request.response will no longer be mutated when using the
render_to_response() API. It is now necessary to
pass in a response= argument to
render_to_response() if you wish to supply the
renderer with a custom response object. If you do not pass one, then a
response object will be created using the current response factory. Almost
all renderers mutate the request.response response object (for example,
the JSON renderer sets request.response.content_type to
application/json). However, when invoking render_to_response, it is
not expected that the response object being returned would be the same one
used later in the request. The response object returned from
render_to_response is now explicitly different from request.response.
This does not change the API of a renderer. See
https://github.com/Pylons/pyramid/pull/1563

In an effort to combat a common issue it is now a
ConfigurationError to register a view
callable that is actually an unbound method when using the default view
mapper. As unbound methods do not exist in PY3+ possible errors are detected
by checking if the first parameter is named self. For example,
config.add_view(ViewClass.some_method, ...) should actually be
config.add_view(ViewClass, attr='some_method)'. This was always an issue
in Pyramid on PY2 but the backward incompatibility is on PY3+ where you may
not use a function with the first parameter named self. In this case
it looks too much like a common error and the exception will be raised.
See https://github.com/Pylons/pyramid/pull/1498

Assets can now be overidden by an absolute path on the filesystem when using
the override_asset() API. This makes it
possible to fully support serving up static content from a mutable directory
while still being able to use the static_url()
API and add_static_view(). Previously it
was not possible to use add_static_view()
with an absolute path and generate urls to the content. This change
replaces the call, config.add_static_view('/abs/path','static'), with
config.add_static_view('myapp:static','static') and
config.override_asset(to_override='myapp:static/',override_with='/abs/path/'). The myapp:static asset spec is completely
made up and does not need to exist—it is used for generating URLs via
request.static_url('myapp:static/foo.png'). See
https://github.com/Pylons/pyramid/issues/1252

Added pyramid.config.Configurator.root_package attribute and init
parameter to assist with includible packages that wish to resolve resources
relative to the package in which the configurator was created. This is
especially useful for add-ons that need to load asset specs from settings, in
which case it may be natural for a developer to define imports or assets
relative to the top-level package. See
https://github.com/Pylons/pyramid/pull/1337

Overall improvements for the proutes command. Added --format and
--glob arguments to the command, introduced the method
column for displaying available request methods, and improved the view
output by showing the module instead of just __repr__. See
https://github.com/Pylons/pyramid/pull/1488

The Configurator has grown the ability to allow
actions to call other actions during a commit cycle. This enables much more
logic to be placed into actions, such as the ability to invoke other actions
or group them for improved conflict detection. We have also exposed and
documented the configuration phases that Pyramid uses in order to further
assist in building conforming add-ons. See
https://github.com/Pylons/pyramid/pull/1513

Please use a real process manager in the future instead of relying on
pserve to daemonize itself. Many options exist, including your operating
system's services, such as Systemd or Upstart, as well as Python-based
solutions like Circus and Supervisor.

The principal argument to pyramid.security.remember() was renamed
to userid. Using principal as the argument name still works and will
continue to work for the next few releases, but a deprecation warning is
printed.

Updated scaffold generating machinery to return the version of Pyramid
and its documentation for use in scaffolds. Updated starter, alchemy
and zodb templates to have links to correctly versioned documentation,
and to reflect which Pyramid was used to generate the scaffold.

Removed non-ASCII copyright symbol from templates, as this was causing the
scaffolds to fail for project generation.