Skip to content

Latest commit

 

History

History
248 lines (198 loc) · 11.7 KB

whatsnew-1.6.rst

File metadata and controls

248 lines (198 loc) · 11.7 KB

What's New in Pyramid 1.6

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

Backwards Incompatibilities

  • 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.py develop:

    setup(
        #...
        install_requires=[
            'pyramid_ipython',         # new dependency
            'pyramid',
            #...
        ],
    )
  • request.response will no longer be mutated when using the :func:`~pyramid.renderers.render_to_response` API. It is now necessary to pass in a response= argument to :func:`~pyramid.renderers.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 Pylons#1563

  • In an effort to combat a common issue it is now a :class:`~pyramid.exceptions.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 Pylons#1498

Feature Additions

Deprecations

  • The pserve command's daemonization features, as well as --monitor-restart, have been deprecated. This includes the [start,stop,restart,status] subcommands, as well as the --daemon, --stop-daemon, --pid-file, --status, --user, and --group flags. See Pylons#2120 and Pylons#2189 and Pylons#1641

    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.

    See Pylons#1641 and Pylons#2120

  • The principal argument to :func:`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.

Scaffolding Enhancements

  • Added line numbers to the log formatters in the scaffolds to assist with debugging. See Pylons#1326
  • Updated scaffold generating machinery to return the version of :app:`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 :app:`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.

Documentation Enhancements

  • Removed logging configuration from Quick Tutorial ini files, except for scaffolding- and logging-related chapters, to avoid needing to explain it too early.
  • Improve and clarify the documentation on what :app:`Pyramid` defines as a principal and a userid in its security APIs. See Pylons#1399
  • Moved the documentation for accept on :meth:`pyramid.config.Configurator.add_view` to no longer be part of the predicate list. See Pylons#1391 for a bug report stating not_ was failing on accept. Discussion with @mcdonc led to the conclusion that it should not be documented as a predicate. See Pylons#1487 for this PR.
  • Clarify a previously-implied detail of the ISession.invalidate API documentation.
  • Add documentation of command line programs (p* scripts). See Pylons#2191