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 13, 2012
2 parents 3aeb794 + 9ff3b26 commit a9f5e70
Show file tree
Hide file tree
Showing 50 changed files with 791 additions and 1,594 deletions.
112 changes: 110 additions & 2 deletions CHANGES.txt
@@ -1,6 +1,7 @@
Next release
============


Bug Fixes
---------

Expand Down Expand Up @@ -86,7 +87,7 @@ Features
HEAD is a variant of GET that omits the body, and WebOb has special support
to return an empty body when a HEAD is used.

- ``config.set_request_method`` has been introduced to support extending
- ``config.add_request_method`` has been introduced to support extending
request objects with arbitrary callables. This method expands on the
previous ``config.set_request_property`` by supporting methods as well as
properties. This method now causes less code to be executed at
Expand Down Expand Up @@ -143,11 +144,118 @@ Features
to influence how the sessions are marshalled (by default this is done
with HMAC+pickle).

- ``pyramid.testing.DummyRequest`` now supports methods supplied by the
``pyramid.util.InstancePropertyMixin`` class such as ``set_property``.

- Request properties and methods added via ``config.set_request_property`` or
``config.add_request_method`` are now available to tweens.

- Request properties and methods added via ``config.set_request_property`` or
``config.add_request_method`` are now available to tweens.

- Request properties and methods added via ``config.set_request_property`` or
``config.add_request_method`` are now available in the request object
returned from ``pyramid.paster.bootstrap``.

- ``request.context`` of environment request during ``bootstrap`` is now the
root object if a context isn't already set on a provided request.

Deprecations
------------

- The ``pyramid.config.Configurator.set_request_property`` has been
documentation-deprecated. The method remains usable but the more
featureful ``pyramid.config.Configurator.set_request_method`` should be
featureful ``pyramid.config.Configurator.add_request_method`` should be
used in its place (it has all of the same capabilities but can also extend
the request object with methods).

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

- The Pyramid router no longer adds the values ``bfg.routes.route`` or
``bfg.routes.matchdict`` to the request's WSGI environment dictionary.
These values were docs-deprecated in ``repoze.bfg`` 1.0 (effectively seven
minor releases ago). If your code depended on these values, use
request.matched_route and request.matchdict instead.

- It is no longer possible to pass an environ dictionary directly to
``pyramid.traversal.ResourceTreeTraverser.__call__`` (aka
``ModelGraphTraverser.__call__``). Instead, you must pass a request
object. Passing an environment instead of a request has generated a
deprecation warning since Pyramid 1.1.

- Pyramid will no longer work properly if you use the
``webob.request.LegacyRequest`` as a request factory. Instances of the
LegacyRequest class have a ``request.path_info`` which return a string.
This Pyramid release assumes that ``request.path_info`` will
unconditionally be Unicode.

- The functions from ``pyramid.chameleon_zpt`` and ``pyramid.chameleon_text``
named ``get_renderer``, ``get_template``, ``render_template``, and
``render_template_to_response`` have been removed. These have issued a
deprecation warning upon import since Pyramid 1.0. Use
``pyramid.renderers.get_renderer()``,
``pyramid.renderers.get_renderer().implementation()``,
``pyramid.renderers.render()`` or ``pyramid.renderers.render_to_response``
respectively instead of these functions.

- The ``pyramid.configuration`` module was removed. It had been deprecated
since Pyramid 1.0 and printed a deprecation warning upon its use. Use
``pyramid.config`` instead.

- The ``pyramid.paster.PyramidTemplate`` API was removed. It had been
deprecated since Pyramid 1.1 and issued a warning on import. If your code
depended on this, adjust your code to import
``pyramid.scaffolds.PyramidTemplate`` instead.

- The ``pyramid.settings.get_settings()`` API was removed. It had been
printing a deprecation warning since Pyramid 1.0. If your code depended on
this API, use ``pyramid.threadlocal.get_current_registry().settings``
instead or use the ``settings`` attribute of the registry available from
the request (``request.registry.settings``).

- These APIs from the ``pyramid.testing`` module were removed. They have
been printing deprecation warnings since Pyramid 1.0:

* ``registerDummySecurityPolicy``, use
``pyramid.config.Configurator.testing_securitypolicy`` instead.

* ``registerResources`` (aka ``registerModels``, use
``pyramid.config.Configurator.testing_resources`` instead.

* ``registerEventListener``, use
``pyramid.config.Configurator.testing_add_subscriber`` instead.

* ``registerTemplateRenderer`` (aka `registerDummyRenderer``), use
``pyramid.config.Configurator.testing_add_template`` instead.

* ``registerView``, use ``pyramid.config.Configurator.add_view`` instead.

* ``registerUtility``, use
``pyramid.config.Configurator.registry.registerUtility`` instead.

* ``registerAdapter``, use
``pyramid.config.Configurator.registry.registerAdapter`` instead.

* ``registerSubscriber``, use
``pyramid.config.Configurator.add_subscriber`` instead.

* ``registerRoute``, use
``pyramid.config.Configurator.add_route`` instead.

* ``registerSettings``, use
``pyramid.config.Configurator.add_settings`` instead.

Documentation
-------------

- Added an "Upgrading Pyramid" chapter to the narrative documentation. It
describes how to cope with deprecations and removals of Pyramid APIs.

Dependencies
------------

- Pyramid now requires WebOb 1.2b3+ (the prior Pyramid release only relied on
1.2dev+). This is to ensure that we obtain a version of WebOb that returns
``request.path_info`` as text.

56 changes: 42 additions & 14 deletions TODO.txt
Expand Up @@ -95,30 +95,58 @@ Nice-to-Have

- Update App engine chapter with less creaky directions.

- Idea from Zart:

diff --git a/pyramid/paster.py b/pyramid/paster.py
index b0e4d79..b3bd82a 100644
--- a/pyramid/paster.py
+++ b/pyramid/paster.py
@@ -8,6 +8,7 @@ from paste.deploy import (
from pyramid.compat import configparser
from logging.config import fileConfig
from pyramid.scripting import prepare
+from pyramid.config import Configurator

def get_app(config_uri, name=None, loadapp=loadapp):
""" Return the WSGI application named ``name`` in the PasteDeploy
@@ -111,3 +112,10 @@ def bootstrap(config_uri, request=None):
env['app'] = app
return env

+def make_pyramid_app(global_conf, app=None, **settings):
+ """Return pyramid application configured with provided settings"""
+ config = Configurator(package='pyramid', settings=settings)
+ if app:
+ config.include(app)
+ app = config.make_wsgi_app()
+ return app
diff --git a/setup.py b/setup.py
index 03ebb42..91e0e21 100644
--- a/setup.py
+++ b/setup.py
@@ -118,6 +118,8 @@ setup(name='pyramid',
[paste.server_runner]
wsgiref = pyramid.scripts.pserve:wsgiref_server_runner
cherrypy = pyramid.scripts.pserve:cherrypy_server_runner
+ [paster.app_factory]
+ main = pyramid.paster:make_pyramid_app
"""
)


Future
------

- 1.4: Kill off ``bfg.routes`` envvars in router.

- 1.4: Remove ``chameleon_text`` / ``chameleon_zpt`` deprecated functions
(render_*)

- 1.4: Remove ``pyramid.configuration`` (deprecated).

- 1.4: Remove ``pyramid.paster.PyramidTemplate`` (deprecated).

- 1.4: Remove ``pyramid.settings.get_settings`` (deprecated).

- 1.5: Remove all deprecated ``pyramid.testing`` functions.
- 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``.

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

- 1.6: Remove IContextURL and TraversalContextURL.

Expand Down
2 changes: 0 additions & 2 deletions docs/api.rst
Expand Up @@ -10,8 +10,6 @@ documentation is organized alphabetically by module name.

api/authorization
api/authentication
api/chameleon_text
api/chameleon_zpt
api/compat
api/config
api/events
Expand Down
31 changes: 0 additions & 31 deletions docs/api/chameleon_text.rst

This file was deleted.

28 changes: 0 additions & 28 deletions docs/api/chameleon_zpt.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/api/config.rst
Expand Up @@ -40,7 +40,7 @@

:methodcategory:`Extending the Request Object`

.. automethod:: set_request_method
.. automethod:: add_request_method
.. automethod:: set_request_property

:methodcategory:`Using I18N`
Expand Down
2 changes: 0 additions & 2 deletions docs/api/settings.rst
Expand Up @@ -5,8 +5,6 @@

.. automodule:: pyramid.settings

.. autofunction:: get_settings

.. autofunction:: asbool

.. autofunction:: aslist
Expand Down
2 changes: 2 additions & 0 deletions docs/changes.rst
@@ -1,3 +1,5 @@
.. _changelog:

:app:`Pyramid` Change History
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -88,6 +88,7 @@ Narrative documentation in chapter form explaining how to use
narr/advconfig
narr/extconfig
narr/scaffolding
narr/upgrading
narr/threadlocals
narr/zca

Expand Down
2 changes: 0 additions & 2 deletions docs/latexindex.rst
Expand Up @@ -85,8 +85,6 @@ API Reference

api/authorization
api/authentication
api/chameleon_text
api/chameleon_zpt
api/config
api/events
api/exceptions
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/advconfig.rst
Expand Up @@ -294,9 +294,9 @@ These are the methods of the configurator which provide conflict detection:
:meth:`~pyramid.config.Configurator.add_view`,
:meth:`~pyramid.config.Configurator.add_route`,
:meth:`~pyramid.config.Configurator.add_renderer`,
: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_method`,
:meth:`~pyramid.config.Configurator.set_request_property`,
:meth:`~pyramid.config.Configurator.set_root_factory`,
:meth:`~pyramid.config.Configurator.set_view_mapper`,
Expand Down
30 changes: 6 additions & 24 deletions docs/narr/templates.rst
Expand Up @@ -46,20 +46,6 @@ within the body of a view callable like so:
{'foo':1, 'bar':2},
request=request)
.. warning::

Earlier iterations of this documentation
(pre-version-1.3) encouraged the application developer to use
ZPT-specific APIs such as
:func:`pyramid.chameleon_zpt.render_template_to_response` and
:func:`pyramid.chameleon_zpt.render_template` to render templates
directly. This style of rendering still works, but at least for
purposes of this documentation, those functions are deprecated.
Application developers are encouraged instead to use the functions
available in the :mod:`pyramid.renderers` module to perform
rendering tasks. This set of functions works to render templates
for all renderer extensions registered with :app:`Pyramid`.

The ``sample_view`` :term:`view callable` function above returns a
:term:`response` object which contains the body of the
``templates/foo.pt`` template. In this case, the ``templates``
Expand All @@ -79,12 +65,12 @@ prefix on Windows.
.. warning::

Only :term:`Chameleon` templates support defining a renderer for a
template relative to the location of the module where the view
callable is defined. Mako templates, and other templating system
bindings work differently. In particular, Mako templates use a
"lookup path" as defined by the ``mako.directories`` configuration
file instead of treating relative paths as relative to the current
view module. See :ref:`mako_templates`.
template relative to the location of the module where the view callable is
defined. Mako templates, and other templating system bindings work
differently. In particular, Mako templates use a "lookup path" as defined
by the ``mako.directories`` configuration file instead of treating
relative paths as relative to the current view module. See
:ref:`mako_templates`.

The path can alternately be a :term:`asset specification` in the form
``some.dotted.package_name:relative/path``. This makes it possible to
Expand Down Expand Up @@ -600,10 +586,6 @@ When the template is rendered, it will show:
Hello, world!
If you'd rather use templates directly within a view callable (without
the indirection of using a renderer), see :ref:`chameleon_text_module`
for the API description.

See also :ref:`built_in_renderers` for more general information about
renderers, including Chameleon text renderers.

Expand Down
2 changes: 1 addition & 1 deletion docs/narr/testing.rst
Expand Up @@ -52,7 +52,7 @@ The suggested mechanism for unit and integration testing of a :app:`Pyramid`
application is the Python :mod:`unittest` module. Although this module is
named :mod:`unittest`, it is actually capable of driving both unit and
integration tests. A good :mod:`unittest` tutorial is available within `Dive
Into Python <http://diveintopython.nfshost.com/unit_testing/index.html>`_ by Mark
Into Python <http://www.diveintopython.net/unit_testing/index.html>`_ by Mark
Pilgrim.

:app:`Pyramid` provides a number of facilities that make unit, integration,
Expand Down

0 comments on commit a9f5e70

Please sign in to comment.