diff options
| author | Chris McDonough <chrism@plope.com> | 2011-07-12 03:52:42 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-07-12 03:52:42 -0400 |
| commit | 82efa44c0d8f4b18b4f341519f54ecad68b56364 (patch) | |
| tree | 3abdcf96776957aacef3c8fcba53e68186d609e2 /docs/whatsnew-1.1.rst | |
| parent | f9896b60700ea4334f3df0a83f9b291e167b322d (diff) | |
| download | pyramid-82efa44c0d8f4b18b4f341519f54ecad68b56364.tar.gz pyramid-82efa44c0d8f4b18b4f341519f54ecad68b56364.tar.bz2 pyramid-82efa44c0d8f4b18b4f341519f54ecad68b56364.zip | |
- 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.
Diffstat (limited to 'docs/whatsnew-1.1.rst')
| -rw-r--r-- | docs/whatsnew-1.1.rst | 16 |
1 files changed, 16 insertions, 0 deletions
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 ------------------ |
