From fca1efe07ac46b2817f30299bbebbc2031cce339 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 6 Jul 2011 14:57:59 -0400 Subject: - The ``config.scan`` method has grown a ``**kw`` argument. ``kw`` argument represents a set of keyword arguments to pass to the Venusian ``Scanner`` object created by Pyramid. (See the Venusian documentation for more information about ``Scanner``). --- docs/whatsnew-1.1.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index fdf3b1c74..a6bb8e99d 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,11 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- The :meth:`pyramid.config.Configurator.scan` method has grown a ``**kw`` + argument. ``kw`` argument represents a set of keyword arguments to pass to + the Venusian ``Scanner`` object created by Pyramid. (See the + :term:`Venusian` documentation for more information about ``Scanner``). + - New request attribute: ``json``. If the request's ``content_type`` is ``application/json``, this attribute will contain the JSON-decoded variant of the request body. If the request's ``content_type`` is not -- cgit v1.2.3 From 6a0602b3ce4d2a6de9dca25d8e0d390796a79267 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 9 Jul 2011 21:12:06 -0400 Subject: request.json -> request.json_body; add some docs for json_body --- docs/whatsnew-1.1.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index a6bb8e99d..a9df38a45 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -99,10 +99,9 @@ Minor Feature Additions the Venusian ``Scanner`` object created by Pyramid. (See the :term:`Venusian` documentation for more information about ``Scanner``). -- New request attribute: ``json``. If the request's ``content_type`` is - ``application/json``, this attribute will contain the JSON-decoded - variant of the request body. If the request's ``content_type`` is not - ``application/json``, this attribute will be ``None``. +- New request property: ``json_body``. This property will return the + JSON-decoded variant of the request body. If the request body is not + well-formed JSON, this property will raise an exception. - A new value ``http_cache`` can be used as a :term:`view configuration` parameter. -- cgit v1.2.3 From 7565006cf1f3b929d9ea54256214f3a39385936a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 10 Jul 2011 00:30:30 -0400 Subject: add info to changes.txt and whatsnew about pshell changes; removed unused import and unwrap string --- docs/whatsnew-1.1.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index a9df38a45..b249b0ba7 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -94,6 +94,19 @@ Default HTTP Exception View Minor Feature Additions ----------------------- +- It is now possible to invoke ``paster pshell`` even if the paste ini file + section name pointed to in its argument is not actually a Pyramid WSGI + application. The shell will work in a degraded mode, and will warn the + user. See "The Interactive Shell" in the "Creating a Pyramid Project" + narrative documentation section. + +- ``paster pshell`` now offers more built-in global variables by default + (including ``app`` and ``settings``). See :ref:`interactive_shell`. + +- It is now possible to add a ``[pshell]`` section to your application's .ini + configuration file, which influences the global names available to a pshell + session. See :ref:`extending_pshell`. + - The :meth:`pyramid.config.Configurator.scan` method has grown a ``**kw`` argument. ``kw`` argument represents a set of keyword arguments to pass to the Venusian ``Scanner`` object created by Pyramid. (See the @@ -295,6 +308,12 @@ Backwards Incompatibilities Deprecations and Behavior Differences ------------------------------------- +- The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands + now take a single argument in the form ``/path/to/config.ini#sectionname`` + rather than the previous 2-argument spelling ``/path/to/config.ini + sectionname``. ``#sectionname`` may be omitted, in which case ``#main`` is + assumed. + - The default Mako renderer is now configured to escape all HTML in expression tags. This is intended to help prevent XSS attacks caused by rendering unsanitized input from users. To revert this behavior in user's -- cgit v1.2.3 From 7cf06765c863ec73adccc73cefcf7630b2020f21 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 03:26:21 -0400 Subject: warn about warnings in 2.7+ --- docs/whatsnew-1.1.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index b249b0ba7..8cf6c715c 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -308,6 +308,15 @@ Backwards Incompatibilities Deprecations and Behavior Differences ------------------------------------- +.. note:: Under Python 2.7+, it's necessary to pass the Python interpreter + the correct warning flags to see deprecation warnings emitted by Pyramid + when porting your application from an older version of Pyramid. Use the + ``PYTHONWARNINGS`` environment variable with the value ``all`` in the + shell you use to invoke ``paster serve`` to see these warnings, e.g. on + UNIX, ``PYTHONWARNINGS=all bin/paster serve development.ini``. Python 2.5 + and 2.6 show deprecation warnings by default, so this is unecessary there. + All deprecation warnings are emitted to the console. + - The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands now take a single argument in the form ``/path/to/config.ini#sectionname`` rather than the previous 2-argument spelling ``/path/to/config.ini -- cgit v1.2.3 From 82efa44c0d8f4b18b4f341519f54ecad68b56364 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 03:52:42 -0400 Subject: - Previously, If a ``BeforeRender`` event subscriber added a value via the ``__setitem__`` or ``update`` methods of the event object with a key that already existed in the renderer globals dictionary, a ``KeyError`` was raised. With the deprecation of the "add_renderer_globals" feature of the configurator, there was no way to override an existing value in the renderer globals dictionary that already existed. Now, the event object will overwrite an older value that is already in the globals dictionary when its ``__setitem__`` or ``update`` is called (as well as the new ``setdefault`` method), just like a plain old dictionary. As a result, for maximum interoperability with other third-party subscribers, if you write an event subscriber meant to be used as a BeforeRender subscriber, your subscriber code will now need to (using ``.get`` or ``__contains__`` of the event object) ensure no value already exists in the renderer globals dictionary before setting an overriding value. --- docs/whatsnew-1.1.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 8cf6c715c..345cbfa30 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -481,6 +481,22 @@ Deprecations and Behavior Differences def expects_object_event(object, event): print object, event +- In 1.0, if a :class:`pyramid.events.BeforeRender` event subscriber added a + value via the ``__setitem__`` or ``update`` methods of the event object + with a key that already existed in the renderer globals dictionary, a + ``KeyError`` was raised. With the deprecation of the + "add_renderer_globals" feature of the configurator, there was no way to + override an existing value in the renderer globals dictionary that already + existed. Now, the event object will overwrite an older value that is + already in the globals dictionary when its ``__setitem__`` or ``update`` is + called (as well as the new ``setdefault`` method), just like a plain old + dictionary. As a result, for maximum interoperability with other + third-party subscribers, if you write an event subscriber meant to be used + as a BeforeRender subscriber, your subscriber code will now need to (using + ``.get`` or ``__contains__`` of the event object) ensure no value already + exists in the renderer globals dictionary before setting an overriding + value. + Dependency Changes ------------------ -- cgit v1.2.3 From 94ab244f121fa1bf8df57f75fad9da5f5f39c594 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 19:21:11 -0400 Subject: - The ``Configurator.add_route`` method allowed two routes with the same route to be added without an intermediate ``config.commit()``. If you now receive a ``ConfigurationError`` at startup time that appears to be ``add_route`` related, you'll need to either a) ensure that all of your route names are unique or b) call ``config.commit()`` before adding a second route with the name of a previously added name or c) use a Configurator that works in ``autocommit`` mode. --- docs/whatsnew-1.1.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 345cbfa30..b55b30238 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -497,6 +497,15 @@ Deprecations and Behavior Differences exists in the renderer globals dictionary before setting an overriding value. +- The :meth:`pyramid.config.Configurator.add_route` method allowed two routes + with the same route to be added without an intermediate call to + :meth:`pyramid.config.Configurator.commit``. If you now receive a + ``ConfigurationError`` at startup time that appears to be ``add_route`` + related, you'll need to either a) ensure that all of your route names are + unique or b) call ``config.commit()`` before adding a second route with the + name of a previously added name or c) use a Configurator that works in + ``autocommit`` mode. + Dependency Changes ------------------ -- cgit v1.2.3 From e573d4356ed0371f5ba34ff3ff396fefd2e55913 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2011 20:56:53 -0400 Subject: - New environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and new configuration file value ``prevent_http_cache``. These are synomymous and allow you to prevent HTTP cache headers from being set by Pyramid's ``http_cache`` machinery globally in a process. see the "Influencing HTTP Caching" section of the "View Configuration" narrative chapter and the detailed documentation for this setting in the "Environment Variables and Configuration Settings" narrative chapter. - New documentation section in View Configuration narrative chapter: "Influencing HTTP Caching". --- docs/whatsnew-1.1.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index b55b30238..20b346090 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -167,6 +167,12 @@ Minor Feature Additions to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` with the first element of ``None``, e.g.: ``(None, {'public':True})``. + The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration + file value ``prevent_http_cache`` are synomymous and allow you to prevent + HTTP cache headers from being set by Pyramid's ``http_cache`` machinery + globally in a process. see :ref:`influencing_http_caching` and + :ref:`preventing_http_caching`. + - A `JSONP `_ renderer. See :ref:`jsonp_renderer` for more details. -- cgit v1.2.3 From 100a571ebbbe7b9f7143ac6015a1b870191683d5 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:15:40 -0400 Subject: forgot to change whatsnew --- docs/whatsnew-1.1.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 20b346090..845170831 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -251,6 +251,16 @@ Minor Feature Additions preprocessor to be specified as a Python callable or Python dotted name. See https://github.com/Pylons/pyramid/pull/183 for rationale. +- New API class: :class:`pyramid.static.static_view`. This supersedes the + (now deprecated) :class:`pyramid.view.static` class. + :class:`pyramid.static.static_view`, by default, serves up documents as the + result of the request's ``path_info``, attribute rather than it's + ``subpath`` attribute (the inverse was true of + :class:`pyramid.view.static`, and still is). + :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use + when you don't want the static view to behave like the older deprecated + version. + Backwards Incompatibilities --------------------------- @@ -323,6 +333,11 @@ Deprecations and Behavior Differences and 2.6 show deprecation warnings by default, so this is unecessary there. All deprecation warnings are emitted to the console. +- The :class:`pyramid.view.static` class has been deprecated in favor of the + newer :class:`pyramid.static.static_view` class. A deprecation warning is + raised when it is used. You should replace it with a reference to + :class:`pyramid.static.static_view` with the ``use_subpath=True`` argument. + - The ``paster pshell``, ``paster proutes``, and ``paster pviews`` commands now take a single argument in the form ``/path/to/config.ini#sectionname`` rather than the previous 2-argument spelling ``/path/to/config.ini -- cgit v1.2.3 From c425a46b73a96c484de50dd9eea1595389f37b3d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:18:02 -0400 Subject: promote http_cache to major feature --- docs/whatsnew-1.1.rst | 120 ++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 57 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 845170831..388c40f46 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -29,6 +29,9 @@ The major feature additions in Pyramid 1.1 are: - Default HTTP exception view. +- ``http_cache`` view configuration parameter causes Pyramid to set HTTP + caching headers. + ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -91,6 +94,66 @@ Default HTTP Exception View exception to that of Pyramid 1.0 (the exception will propagate to middleware and to the WSGI server). +``http_cache`` +~~~~~~~~~~~~~~ + +A new value ``http_cache`` can be used as a :term:`view configuration` +parameter. + +When you supply an ``http_cache`` value to a view configuration, the +``Expires`` and ``Cache-Control`` headers of a response generated by the +associated view callable are modified. The value for ``http_cache`` may be +one of the following: + +- A nonzero integer. If it's a nonzero integer, it's treated as a number + of seconds. This number of seconds will be used to compute the + ``Expires`` header and the ``Cache-Control: max-age`` parameter of + responses to requests which call this view. For example: + ``http_cache=3600`` instructs the requesting browser to 'cache this + response for an hour, please'. + +- A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` + instance, it will be converted into a number of seconds, and that number + of seconds will be used to compute the ``Expires`` header and the + ``Cache-Control: max-age`` parameter of responses to requests which call + this view. For example: ``http_cache=datetime.timedelta(days=1)`` + instructs the requesting browser to 'cache this response for a day, + please'. + +- Zero (``0``). If the value is zero, the ``Cache-Control`` and + ``Expires`` headers present in all responses from this view will be + composed such that client browser cache (and any intermediate caches) are + instructed to never cache the response. + +- A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, + {'public':True})``), the first value in the tuple may be a nonzero + integer or a ``datetime.timedelta`` instance; in either case this value + will be used as the number of seconds to cache the response. The second + value in the tuple must be a dictionary. The values present in the + dictionary will be used as input to the ``Cache-Control`` response + header. For example: ``http_cache=(3600, {'public':True})`` means 'cache + for an hour, and add ``public`` to the Cache-Control header of the + response'. All keys and values supported by the + ``webob.cachecontrol.CacheControl`` interface may be added to the + dictionary. Supplying ``{'public':True}`` is equivalent to calling + ``response.cache_control.public = True``. + +Providing a non-tuple value as ``http_cache`` is equivalent to calling +``response.cache_expires(value)`` within your view's body. + +Providing a two-tuple value as ``http_cache`` is equivalent to calling +``response.cache_expires(value[0], **value[1])`` within your view's body. + +If you wish to avoid influencing, the ``Expires`` header, and instead wish +to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` +with the first element of ``None``, e.g.: ``(None, {'public':True})``. + +The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration +file value ``prevent_http_cache`` are synomymous and allow you to prevent +HTTP cache headers from being set by Pyramid's ``http_cache`` machinery +globally in a process. see :ref:`influencing_http_caching` and +:ref:`preventing_http_caching`. + Minor Feature Additions ----------------------- @@ -116,63 +179,6 @@ Minor Feature Additions JSON-decoded variant of the request body. If the request body is not well-formed JSON, this property will raise an exception. -- A new value ``http_cache`` can be used as a :term:`view configuration` - parameter. - - When you supply an ``http_cache`` value to a view configuration, the - ``Expires`` and ``Cache-Control`` headers of a response generated by the - associated view callable are modified. The value for ``http_cache`` may be - one of the following: - - - A nonzero integer. If it's a nonzero integer, it's treated as a number - of seconds. This number of seconds will be used to compute the - ``Expires`` header and the ``Cache-Control: max-age`` parameter of - responses to requests which call this view. For example: - ``http_cache=3600`` instructs the requesting browser to 'cache this - response for an hour, please'. - - - A ``datetime.timedelta`` instance. If it's a ``datetime.timedelta`` - instance, it will be converted into a number of seconds, and that number - of seconds will be used to compute the ``Expires`` header and the - ``Cache-Control: max-age`` parameter of responses to requests which call - this view. For example: ``http_cache=datetime.timedelta(days=1)`` - instructs the requesting browser to 'cache this response for a day, - please'. - - - Zero (``0``). If the value is zero, the ``Cache-Control`` and - ``Expires`` headers present in all responses from this view will be - composed such that client browser cache (and any intermediate caches) are - instructed to never cache the response. - - - A two-tuple. If it's a two tuple (e.g. ``http_cache=(1, - {'public':True})``), the first value in the tuple may be a nonzero - integer or a ``datetime.timedelta`` instance; in either case this value - will be used as the number of seconds to cache the response. The second - value in the tuple must be a dictionary. The values present in the - dictionary will be used as input to the ``Cache-Control`` response - header. For example: ``http_cache=(3600, {'public':True})`` means 'cache - for an hour, and add ``public`` to the Cache-Control header of the - response'. All keys and values supported by the - ``webob.cachecontrol.CacheControl`` interface may be added to the - dictionary. Supplying ``{'public':True}`` is equivalent to calling - ``response.cache_control.public = True``. - - Providing a non-tuple value as ``http_cache`` is equivalent to calling - ``response.cache_expires(value)`` within your view's body. - - Providing a two-tuple value as ``http_cache`` is equivalent to calling - ``response.cache_expires(value[0], **value[1])`` within your view's body. - - If you wish to avoid influencing, the ``Expires`` header, and instead wish - to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` - with the first element of ``None``, e.g.: ``(None, {'public':True})``. - - The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration - file value ``prevent_http_cache`` are synomymous and allow you to prevent - HTTP cache headers from being set by Pyramid's ``http_cache`` machinery - globally in a process. see :ref:`influencing_http_caching` and - :ref:`preventing_http_caching`. - - A `JSONP `_ renderer. See :ref:`jsonp_renderer` for more details. -- cgit v1.2.3 From 10408c799257d6727c968d63cf439b1ebfbfd335 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:18:46 -0400 Subject: typo --- docs/whatsnew-1.1.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 388c40f46..dd4d488a0 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -264,8 +264,7 @@ Minor Feature Additions ``subpath`` attribute (the inverse was true of :class:`pyramid.view.static`, and still is). :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use - when you don't want the static view to behave like the older deprecated - version. + when you want the static view to behave like the older deprecated version. Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From c515d77de5b2f62727251ebc32d1292e67811771 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 15 Jul 2011 10:13:07 -0400 Subject: - get_root2 -> prepare - change prepare return value to a dict, and return the registry, request, etc - various docs and changelog entries. --- docs/whatsnew-1.1.rst | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index dd4d488a0..32955ab75 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -266,6 +266,45 @@ Minor Feature Additions :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use when you want the static view to behave like the older deprecated version. +- A new API function :func:`pyramid.paster.bootstrap` has been added to make + writing scripts that bootstrap a Pyramid environment easier, e.g.: + + .. code-block:: python + + from pyramid.paster import bootstrap + info = bootstrap('/path/to/my/development.ini') + request = info['request'] + print request.route_url('myroute') + +- A new api function :func:`pyramid.scripting.prepare` has been added. It is + a lower-level analogue of :func:`pyramid.paster.boostrap` that accepts a + request and a registry instead of a config file argument, and is used for + the same purpose: + + .. code-block:: python + + from pyramid.scripting import prepare + info = prepare(registry=myregistry) + request = info['request'] + print request.route_url('myroute') + +- A new API function :func:`pyramid.scripting.make_request` has been added. + The resulting request will have a ``registry`` attribute. It is meant to + be used in conjunction with :func:`pyramid.scripting.prepare` and/or + :func:`pyramid.paster.bootstrap` (both of which accept a request as an + argument): + + .. code-block:: python + + from pyramid.scripting import make_request + request = make_request('/') + +- New API attribute :attr:`pyramid.config.global_registries` is an iterable + object that contains references to every Pyramid registry loaded into the + current process via :meth:`pyramid.config.Configurator.make_app`. It also + has a ``last`` attribute containing the last registry loaded. This is used + by the scripting machinery, and is available for introspection. + Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From 5fb458c0dd70096e5d619e42992390bb1af071e1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 01:08:43 -0400 Subject: - Added a section entitled "Writing a Script" to the "Command-Line Pyramid" chapter. --- docs/whatsnew-1.1.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 32955ab75..a37f03a66 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -583,6 +583,9 @@ Dependency Changes Documentation Enhancements -------------------------- +- Added a section entitled :ref:`writing_a_script` to the "Command-Line + Pyramid" chapter. + - The :ref:`bfg_wiki_tutorial` was updated slightly. - The :ref:`bfg_sql_wiki_tutorial` was updated slightly. -- cgit v1.2.3 From 8a8724de56c8dcce763fdb5630c77cb69a149572 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 01:29:52 -0400 Subject: promote bootstrap to major feature --- docs/whatsnew-1.1.rst | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index a37f03a66..48be2190f 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -32,6 +32,9 @@ The major feature additions in Pyramid 1.1 are: - ``http_cache`` view configuration parameter causes Pyramid to set HTTP caching headers. +- Features that make it easier to write scripts that work in a :app:`Pyramid` + environment. + ``request.response`` ~~~~~~~~~~~~~~~~~~~~ @@ -154,6 +157,21 @@ HTTP cache headers from being set by Pyramid's ``http_cache`` machinery globally in a process. see :ref:`influencing_http_caching` and :ref:`preventing_http_caching`. +Easier Scripting Writing +~~~~~~~~~~~~~~~~~~~~~~~~ + +A new API function :func:`pyramid.paster.bootstrap` has been added to make +writing scripts that need to work under Pyramid environment easier, e.g.: + +.. code-block:: python + + from pyramid.paster import bootstrap + info = bootstrap('/path/to/my/development.ini') + request = info['request'] + print request.route_url('myroute') + +See :ref:`writing_a_script` for more details. + Minor Feature Additions ----------------------- @@ -266,16 +284,6 @@ Minor Feature Additions :class:`pyramid.static.static_view` exposes a ``use_subpath`` flag for use when you want the static view to behave like the older deprecated version. -- A new API function :func:`pyramid.paster.bootstrap` has been added to make - writing scripts that bootstrap a Pyramid environment easier, e.g.: - - .. code-block:: python - - from pyramid.paster import bootstrap - info = bootstrap('/path/to/my/development.ini') - request = info['request'] - print request.route_url('myroute') - - A new api function :func:`pyramid.scripting.prepare` has been added. It is a lower-level analogue of :func:`pyramid.paster.boostrap` that accepts a request and a registry instead of a config file argument, and is used for -- cgit v1.2.3 From 9c5b83710cd86ef4ddeae49a37518d869e504308 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 20:09:05 -0400 Subject: mention paster pshell using bootstrap --- docs/whatsnew-1.1.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 48be2190f..40deb55e4 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -184,6 +184,12 @@ Minor Feature Additions - ``paster pshell`` now offers more built-in global variables by default (including ``app`` and ``settings``). See :ref:`interactive_shell`. +- The ``paster pshell`` command now under the hood uses + :func:`pyramid.paster.bootstrap`, which makes it possible to supply an + ``.ini`` file without naming the "right" section in the file that points at + the actual Pyramid application. Instead, you can generally just run + ``paster pshell development.ini`` and it will do mostly the right thing. + - It is now possible to add a ``[pshell]`` section to your application's .ini configuration file, which influences the global names available to a pshell session. See :ref:`extending_pshell`. -- cgit v1.2.3 From af056046970db9b1d3732f4c5978fcb3fb863d1f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 Jul 2011 21:23:07 -0400 Subject: - Change paster pviews and paster proutes to use bootstrap. --- docs/whatsnew-1.1.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 40deb55e4..9e6d7b5ae 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -181,14 +181,12 @@ Minor Feature Additions user. See "The Interactive Shell" in the "Creating a Pyramid Project" narrative documentation section. -- ``paster pshell`` now offers more built-in global variables by default - (including ``app`` and ``settings``). See :ref:`interactive_shell`. - -- The ``paster pshell`` command now under the hood uses - :func:`pyramid.paster.bootstrap`, which makes it possible to supply an - ``.ini`` file without naming the "right" section in the file that points at - the actual Pyramid application. Instead, you can generally just run - ``paster pshell development.ini`` and it will do mostly the right thing. +- The ``paster pshell``, ``paster pviews``, and ``paster proutes`` commands + each now under the hood uses :func:`pyramid.paster.bootstrap`, which makes + it possible to supply an ``.ini`` file without naming the "right" section + in the file that points at the actual Pyramid application. Instead, you + can generally just run ``paster {pshell|proutes|pviews} development.ini`` + and it will do mostly the right thing. - It is now possible to add a ``[pshell]`` section to your application's .ini configuration file, which influences the global names available to a pshell -- cgit v1.2.3 From 9006b205d907b0b52b59de0eb1e203afdcdbdd51 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 21 Jul 2011 22:05:58 -0400 Subject: add nullrenderer to whatsnew --- docs/whatsnew-1.1.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 9e6d7b5ae..6761aaff8 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -317,6 +317,16 @@ Minor Feature Additions has a ``last`` attribute containing the last registry loaded. This is used by the scripting machinery, and is available for introspection. +- Added the :attr:`pyramid.renderers.null_renderer` object as an API. The + null renderer is an object that can be used in advanced integration cases + as input to the view configuration ``renderer=`` argument. When the null + renderer is used as a view renderer argument, Pyramid avoids converting the + view callable result into a Response object. This is useful if you want to + reuse the view configuration and lookup machinery outside the context of + its use by the Pyramid router. (This feature was added for consumption by + the ``pyramid_rpc`` package, which uses view configuration and lookup + outside the context of a router in exactly this way.) + Backwards Incompatibilities --------------------------- -- cgit v1.2.3 From acd256b2eb3304834ef0b87f499b1f85dbb014b7 Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 00:08:40 -0700 Subject: fix typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 6761aaff8..c3161a010 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -152,7 +152,7 @@ to only influence ``Cache-Control`` headers, pass a tuple as ``http_cache`` with the first element of ``None``, e.g.: ``(None, {'public':True})``. The environment setting ``PYRAMID_PREVENT_HTTP_CACHE`` and configuration -file value ``prevent_http_cache`` are synomymous and allow you to prevent +file value ``prevent_http_cache`` are synonymous and allow you to prevent HTTP cache headers from being set by Pyramid's ``http_cache`` machinery globally in a process. see :ref:`influencing_http_caching` and :ref:`preventing_http_caching`. -- cgit v1.2.3 From 9f164eeb0ccd77d47e22de5d57739452dfad3cbe Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 00:41:03 -0700 Subject: removed extra word --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index c3161a010..2a637136f 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -479,7 +479,7 @@ Deprecations and Behavior Differences these methods will be removed entirely. - A custom request factory is now required to return a request object that - has a ``response`` attribute (or "reified"/lazy property) if they the + has a ``response`` attribute (or "reified"/lazy property) if the request is meant to be used in a view that uses a renderer. This ``response`` attribute should be an instance of the class :class:`pyramid.response.Response`. -- cgit v1.2.3 From a37a8e4ec1c5b78387b8e93683792c74e8aedcca Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 01:01:34 -0700 Subject: Removed extra word, corrected unfinished sentence --- docs/whatsnew-1.1.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 2a637136f..300b58dbf 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -542,8 +542,8 @@ Deprecations and Behavior Differences - Deprecated the :meth:`pyramid.config.Configurator.set_renderer_globals_factory` method and the ``renderer_globals`` Configurator constructor parameter. Users should - use convert code using this feature to use a BeforeRender event als - :ref:`beforerender_event`. + convert code using this feature to use a BeforeRender event. See the section + :ref:`beforerender_event` in the Hooks chapter. - In Pyramid 1.0, the :class:`pyramid.events.subscriber` directive behaved contrary to the documentation when passed more than one interface object to -- cgit v1.2.3 From a03b793abe9a9b5719593716c0191cdc0e9b741b Mon Sep 17 00:00:00 2001 From: Carlos de la Guardia Date: Sat, 23 Jul 2011 01:06:31 -0700 Subject: Fixed typo --- docs/whatsnew-1.1.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/whatsnew-1.1.rst') diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index 300b58dbf..18d0aa0b1 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -586,7 +586,7 @@ Deprecations and Behavior Differences - The :meth:`pyramid.config.Configurator.add_route` method allowed two routes with the same route to be added without an intermediate call to - :meth:`pyramid.config.Configurator.commit``. If you now receive a + :meth:`pyramid.config.Configurator.commit`. If you now receive a ``ConfigurationError`` at startup time that appears to be ``add_route`` related, you'll need to either a) ensure that all of your route names are unique or b) call ``config.commit()`` before adding a second route with the -- cgit v1.2.3