Skip to content

Commit

Permalink
Merge branch 'feature.14removedeprecations'
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Sep 10, 2012
2 parents f6bd88e + b6a102e commit dcbe7d5
Show file tree
Hide file tree
Showing 25 changed files with 175 additions and 1,375 deletions.
85 changes: 85 additions & 0 deletions CHANGES.txt
Expand Up @@ -152,3 +152,88 @@ Deprecations
featureful ``pyramid.config.Configurator.set_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.

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.

13 changes: 1 addition & 12 deletions TODO.txt
Expand Up @@ -98,18 +98,7 @@ Nice-to-Have
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
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: 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
92 changes: 0 additions & 92 deletions pyramid/chameleon_text.py
@@ -1,6 +1,5 @@
import sys

from zope.deprecation import deprecated
from zope.interface import implementer

from pyramid.compat import reraise
Expand All @@ -20,7 +19,6 @@ def __init__(self, *arg, **kw):

from pyramid.decorator import reify
from pyramid import renderers
from pyramid.path import caller_package

def renderer_factory(info):
return renderers.template_renderer_factory(info, TextTemplateRenderer)
Expand Down Expand Up @@ -52,93 +50,3 @@ def __call__(self, value, system):
result = self.template(**system)
return result

def get_renderer(path):
""" Return a callable object which can be used to render a
:term:`Chameleon` text template using the template implied by the
``path`` argument. The ``path`` argument may be a
package-relative path, an absolute path, or a :term:`asset
specification`.
.. warning::
This API is deprecated in :app:`Pyramid` 1.0. Use
:func:`pyramid.renderers.get_renderer` instead.
"""
package = caller_package()
factory = renderers.RendererHelper(path, package=package)
return factory.get_renderer()

deprecated(
'get_renderer',
'(pyramid.chameleon_text.get_renderer is deprecated '
'as of Pyramid 1.0; instead use pyramid.renderers.get_renderer)')

def get_template(path):
""" Return the underyling object representing a :term:`Chameleon`
text template using the template implied by the ``path`` argument.
The ``path`` argument may be a package-relative path, an absolute
path, or a :term:`asset specification`.
.. warning::
This API is deprecated in :app:`Pyramid` 1.0. Use
the ``implementation()`` method of a template renderer retrieved via
:func:`pyramid.renderers.get_renderer` instead.
"""
package = caller_package()
factory = renderers.RendererHelper(path, package=package)
return factory.get_renderer().implementation()

deprecated(
'get_template',
'(pyramid.chameleon_text.get_template is deprecated '
'as of Pyramid 1.0; instead use '
'pyramid.renderers.get_renderer().implementation())')

def render_template(path, **kw):
""" Render a :term:`Chameleon` text template using the template
implied by the ``path`` argument. The ``path`` argument may be a
package-relative path, an absolute path, or a :term:`asset
specification`. The arguments in ``*kw`` are passed as top-level
names to the template, and so may be used within the template
itself. Returns a string.
.. warning::
This API is deprecated in :app:`Pyramid` 1.0. Use
:func:`pyramid.renderers.render` instead.
"""
package = caller_package()
request = kw.pop('request', None)
renderer = renderers.RendererHelper(path, package=package)
return renderer.render(kw, None, request=request)

deprecated(
'render_template',
'(pyramid.chameleon_text.render_template is deprecated '
'as of Pyramid 1.0; instead use pyramid.renderers.render)')

def render_template_to_response(path, **kw):
""" Render a :term:`Chameleon` text template using the template
implied by the ``path`` argument. The ``path`` argument may be a
package-relative path, an absolute path, or a :term:`asset
specification`. The arguments in ``*kw`` are passed as top-level
names to the template, and so may be used within the template
itself. Returns a :term:`Response` object with the body as the
template result.
.. warning::
This API is deprecated in :app:`Pyramid` 1.0. Use
:func:`pyramid.renderers.render_to_response` instead.
"""
package = caller_package()
request = kw.pop('request', None)
renderer = renderers.RendererHelper(path, package=package)
return renderer.render_to_response(kw, None, request=request)

deprecated(
'render_template_to_response',
'(pyramid.chameleon_text.render_template_to_response is deprecated '
'as of Pyramid 1.0; instead use pyramid.renderers.render_to_response)')

0 comments on commit dcbe7d5

Please sign in to comment.