Pyramid 1.1b1 released

32 views
Skip to first unread message

Chris McDonough

unread,
Jul 10, 2011, 1:16:55 AM7/10/11
to pylons-discuss
Pyramid 1.1b1 has been released.

Here are the changes:

Features
--------

- 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 "The Interactive
Shell" in the "Creating a Pyramid Project" narrative documentation
section.

- 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 "Extending the Shell" in
the "Creating a Pyramid Project" narrative documentation chapter.

- 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``).

- 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 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})``.

Bug Fixes
---------

- Framework wrappers of the original view (such as http_cached and so
on) relied on being able to trust that the response they were
receiving was an IResponse. It wasn't always, because the response
was resolved by the router instead of early in the view wrapping
process. This has been fixed.

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

- Added a section in the "Webob" chapter named "Dealing With A
JSON-Encoded Request Body" (usage of ``request.json_body``).

Behavior Changes
----------------

- 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.

A "What's New In Pyramid 1.1" document exists at
http://docs.pylonsproject.org/projects/pyramid/1.1/whatsnew-1.1.html .

You will be able to see the 1.1 release documentation (across all
alphas and betas, as well as when it eventually gets to final release)
at http://docs.pylonsproject.org/projects/pyramid/1.1/ .

You can install it via PyPI:

easy_install Pyramid==1.1b1

Enjoy, and please report any issues you find to the issue tracker at
https://github.com/Pylons/pyramid/issues

Special thanks to Mike Merickel (raydeo) for work on this release.

Thanks!

- C


Tony Theodore

unread,
Jul 10, 2011, 2:43:28 AM7/10/11
to pylons-...@googlegroups.com
On 10 July 2011 15:16, Chris McDonough <chr...@plope.com> wrote:
> Pyramid 1.1b1 has been released.

Great news, looking forward to it!

[...]

> You can install it via PyPI:
>
>  easy_install Pyramid==1.1b1

I noticed with the alphas (same with the new beta) that either:

easy_install pyramid
easy_install -U pyramid

will install the latest dev version (pip does the same). This may be
surprising, especially for newcomers, as it means people inadvertently
become testers.

Cheers,

Tony

Chris McDonough

unread,
Jul 10, 2011, 2:51:52 AM7/10/11
to pylons-...@googlegroups.com

Yep. "It's intentional" would be an overstatement, but until Python
fixes its catalog story, embracing that particular suckiness is my
preference. If you need a particular version, pin it.

- C


Eric Ongerth

unread,
Jul 12, 2011, 2:40:25 AM7/12/11
to pylons-discuss
Really happy about the convenience of the http_cache view
configuration parameter. Thanks a bunch for all the hard work.

E
> Enjoy, and please report any issues you find to the issue tracker athttps://github.com/Pylons/pyramid/issues
Reply all
Reply to author
Forward
0 new messages