Pyramid

Latest version: v2.0.2

Safety actively analyzes 685838 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 23 of 30

0.6.6

==================

Implementation Changes
----------------------

- There is an indirection in ``repoze.bfg.url.model_url`` now that
consults a utility to generate the base model url (without extra
elements or a query string). Eventually this will service virtual
hosting; for now it's undocumented and should not be hooked.

0.6.5

==================

Features
--------

- You can now override the NotFound and Unauthorized responses that
``repoze.bfg`` generates when a view cannot be found or cannot be
invoked due to lack of permission. See the "ZCML Hooks" chapter in
the docs for more information.

- Added Routes ZCML directive attribute explanations in documentation.

- Added a ``traversal_path`` API to the traversal module; see the
"traversal" API chapter in the docs. This was a function previously
known as ``split_path`` that was not an API but people were using it
anyway. Unlike ``split_path``, it now returns a tuple instead of a
list (as its values are cached).

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

- The ``repoze.bfg.view.render_view_to_response`` API will no longer
raise a ValueError if an object returned by a view function it calls
does not possess certain attributes (``headerlist``, ``app_iter``,
``status``). This API used to attempt to perform a check using the
``is_response`` function in ``repoze.bfg.view``, and raised a
``ValueError`` if the ``is_response`` check failed. The
responsibility is now the caller's to ensure that the return value
from a view function is a "real" response.

- WSGI environ dicts passed to ``repoze.bfg`` 's Router must now
contain a REQUEST_METHOD key/value; if they do not, a KeyError will
be raised (speed).

- It is no longer permissible to pass a "nested" list of principals to
``repoze.bfg.ACLAuthorizer.permits`` (e.g. ``['fred', ['larry',
'bob']]``). The principals list must be fully expanded. This
feature was never documented, and was never an API, so it's not a
backwards incompatibility.

- It is no longer permissible for a security ACE to contain a "nested"
list of permissions (e.g. ``(Allow, Everyone, ['read', ['view',
['write', 'manage']]])`)`. The list must instead be fully expanded
(e.g. ``(Allow, Everyone, ['read', 'view', 'write', 'manage])``). This
feature was never documented, and was never an API, so it's not a
backwards incompatibility.

- The ``repoze.bfg.urldispatch.RoutesRootFactory`` now injects the
``wsgiorg.routing_args`` environment variable into the environ when
a route matches. This is a tuple of ((), routing_args) where
routing_args is the value that comes back from the routes mapper
match (the "match dict").

- The ``repoze.bfg.traversal.RoutesModelTraverser`` class now wants to
obtain the ``view_name`` and ``subpath`` from the
``wsgiorgs.routing_args`` environment variable. It falls back to
obtaining these from the context for backwards compatibility.

Implementation Changes
----------------------

- Get rid of ``repoze.bfg.security.ACLAuthorizer``: the
``ACLSecurityPolicy`` now does what it did inline.

- Get rid of ``repoze.bfg.interfaces.NoAuthorizationInformation``
exception: it was used only by ``ACLAuthorizer``.

- Use a homegrown NotFound error instead of ``webob.exc.HTTPNotFound``
(the latter is slow).

- Use a homegrown Unauthorized error instead of
``webob.exc.Unauthorized`` (the latter is slow).

- the ``repoze.bfg.lru.lru_cached`` decorator now uses functools.wraps
in order to make documentation of LRU-cached functions possible.

- Various speed micro-tweaks.

Bug Fixes
---------

- ``repoze.bfg.testing.DummyModel`` did not have a ``get`` method;
it now does.

0.6.4

==================

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

- The ``unicode_path_segments`` configuration variable and the
``BFG_UNICODE_PATH_SEGMENTS`` configuration variable have been
removed. Path segments are now always passed to model
``__getitem__`` methods as unicode. "True" has been the default for
this setting since 0.5.4, but changing this configuration setting to
false allowed you to go back to passing raw path element strings to
model ``__getitem__`` methods. Removal of this knob services a
speed goal (we get about +80 req/s by removing the check), and it's
clearer just to always expect unicode path segments in model
``__getitem__`` methods.

Implementation Changes
----------------------

- ``repoze.bfg.traversal.split_path`` now also handles decoding
path segments to unicode (for speed, because its results are
cached).

- ``repoze.bfg.traversal.step`` was made a method of the
ModelGraphTraverser.

- Use "precooked" Request subclasses
(e.g. ``repoze.bfg.request.GETRequest``) that correspond to HTTP
request methods within ``router.py`` when constructing a request
object rather than using ``alsoProvides`` to attach the proper
interface to an unsubclassed ``webob.Request``. This pattern is
purely an optimization (e.g. preventing calls to ``alsoProvides``
means the difference between 590 r/s and 690 r/s on a MacBook 2GHz).

- Tease out an extra 4% performance boost by changing the Router;
instead of using imported ZCA APIs, use the same APIs directly
against the registry that is an attribute of the Router.

- The registry used by BFG is now a subclass of
``zope.component.registry.Components`` (defined as
``repoze.bfg.registry.Registry``); it has a ``notify`` method, a
``registerSubscriptionAdapter`` and a ``registerHandler`` method.
If no subscribers are registered via ``registerHandler`` or
``registerSubscriptionAdapter``, ``notify`` is a noop for speed.

- The Allowed and Denied classes in ``repoze.bfg.security`` now are
lazier about constructing the representation of a reason message for
speed; ``repoze.bfg.view_execution_permitted`` takes advantage of
this.

- The ``is_response`` check was sped up by about half at the expense
of making its code slightly uglier.

New Modules
-----------

- ``repoze.bfg.lru`` implements an LRU cache class and a decorator for
internal use.

0.6.3

==================

Bug Fixes
---------

- Readd ``root_policy`` attribute on Router object (as a property
which returns the IRootFactory utility). It was inadvertently
removed in 0.6.2. Code in the wild depended upon its presence
(esp. scripts and "debug" helpers).

Features
--------

- URL-dispatch has been overhauled: it is no longer necessary to
manually create a RoutesMapper in your application's entry point
callable in order to use URL-dispatch (aka `Routes
<https://routes.readthedocs.io/en/latest/>`_). A new ``route`` directive has been
added to the available list of ZCML directives. Each ``route``
directive inserted into your application's ``configure.zcml``
establishes a Routes mapper connection. If any ``route``
declarations are made via ZCML within a particular application, the
``get_root`` callable passed in to ``repoze.bfg.router.make_app``
will automatically be wrapped in the equivalent of a RoutesMapper.
Additionally, the new ``route`` directive allows the specification
of a ``context_interfaces`` attribute for a route, this will be used
to tag the manufactured routes context with specific interfaces when
a route specifying a ``context_interfaces`` attribute is matched.

- A new interface ``repoze.bfg.interfaces.IContextNotFound`` was
added. This interface is attached to a "dummy" context generated
when Routes cannot find a match and there is no "fallback" get_root
callable that uses traversal.

- The ``bfg_starter`` and ``bfg_zodb`` "paster create" templates now
contain images and CSS which are displayed when the default page is
displayed after initial project generation.

- Allow the ``repoze.bfg.view.static`` helper to be passed a relative
``root_path`` name; it will be considered relative to the file in
which it was called.

- The functionality of ``repoze.bfg.convention`` has been merged into
the core. Applications which make use of ``repoze.bfg.convention``
will continue to work indefinitely, but it is recommended that apps
stop depending upon it. To do so, substitute imports of
``repoze.bfg.convention.bfg_view`` with imports of
``repoze.bfg.view.bfg_view``, and change the stanza in ZCML from
``<convention package=".">`` to ``<scan package=".">``. As a result
of the merge, bfg has grown a new dependency: ``martian``.

- View functions which use the pushpage decorator are now pickleable
(meaning their use won't prevent a ``configure.zcml.cache`` file
from being written to disk).

- Instead of invariably using ``webob.Request`` as the "request
factory" (e.g. in the ``Router`` class) and ``webob.Response`` and
the "response factory" (e.g. in ``render_template_to_response``),
allow both to be overridden via a ZCML utility hook. See the "Using
ZCML Hooks" chapter of the documentation for more information.

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

- The class ``repoze.bfg.urldispatch.RoutesContext`` has been renamed
to ``repoze.bfg.urldispatch.DefaultRoutesContext``. The class
should be imported by the new name as necessary (although in reality
it probably shouldn't be imported from anywhere except internally
within BFG, as it's not part of the API).

Implementation Changes
----------------------

- The ``repoze.bfg.wsgi.wsgiapp`` decorator now uses
``webob.Request.get_response`` to do its work rather than relying on
homegrown WSGI code.

- The ``repoze.bfg.view.static`` helper now uses
``webob.Request.get_response`` to do its work rather than relying on
homegrown WSGI code.

- The ``repoze.bfg.urldispatch.RoutesModelTraverser`` class has been
moved to ``repoze.bfg.traversal.RoutesModelTraverser``.

- The ``repoze.bfg.registry.makeRegistry`` function was renamed to
``repoze.bfg.registry.populateRegistry`` and now accepts a
``registry`` argument (which should be an instance of
``zope.component.registry.Components``).

Documentation Additions
-----------------------

- Updated narrative urldispatch chapter with changes required by
``<route..>`` ZCML directive.

- Add a section on "Using BFG Security With URL Dispatch" into the
urldispatch chapter of the documentation.

- Better documentation of security policy implementations that ship
with repoze.bfg.

- Added a "Using ZPT Macros in repoze.bfg" section to the narrative
templating chapter.

0.6.2

==================

Features
--------

- Tests can be run with coverage output if you've got ``nose``
installed in the interpreter which you use to run tests. Using an
interpreter with ``nose`` installed, do ``python setup.py
nosetests`` within a checkout of the ``repoze.bfg`` package to see
test coverage output.

- Added a ``post`` argument to the ``repoze.bfg.testing:DummyRequest``
constructor.

- Added ``__len__`` and ``__nonzero__`` to ``repoze.bfg.testing:DummyModel``.

- The ``repoze.bfg.registry.get_options`` callable (now renamed to
``repoze.bfg.setings.get_options``) used to return only
framework-specific keys and values in the dictionary it returned.
It now returns all the keys and values in the dictionary it is
passed *plus* any framework-specific settings culled from the
environment. As a side effect, all PasteDeploy application-specific
config file settings are made available as attributes of the
``ISettings`` utility from within BFG.

- Renamed the existing BFG paster template to ``bfg_starter``. Added
another template (``bfg_zodb``) showing default ZODB setup using
``repoze.zodbconn``.

- Add a method named ``assert_`` to the DummyTemplateRenderer. This
method accepts keyword arguments. Each key/value pair in the
keyword arguments causes an assertion to be made that the renderer
received this key with a value equal to the asserted value.

- Projects generated by the paster templates now use the
``DummyTemplateRenderer.assert_`` method in their view tests.

- Make the (internal) thread local registry manager maintain a stack
of registries in order to make it possible to call one BFG
application from inside another.

- An interface specific to the HTTP verb (GET/PUT/POST/DELETE/HEAD) is
attached to each request object on ingress. The HTTP-verb-related
interfaces are defined in ``repoze.bfg.interfaces`` and are
``IGETRequest``, ``IPOSTRequest``, ``IPUTRequest``,
``IDELETERequest`` and ``IHEADRequest``. These interfaces can be
specified as the ``request_type`` attribute of a bfg view
declaration. A view naming a specific HTTP-verb-matching interface
will be found only if the view is defined with a request_type that
matches the HTTP verb in the incoming request. The more general
``IRequest`` interface can be used as the request_type to catch all
requests (and this is indeed the default). All requests implement
``IRequest``. The HTTP-verb-matching idea was pioneered by
`repoze.bfg.restrequest
<https://pypi.org/project/repoze.bfg.restrequest/1.0.1/>`_ . That
package is no longer required, but still functions fine.

Bug Fixes
---------

- Fix a bug where the Paste configuration's ``unicode_path_segments``
(and os.environ's ``BFG_UNICODE_PATH_SEGMENTS``) may have been
defaulting to false in some circumstances. It now always defaults
to true, matching the documentation and intent.

- The ``repoze.bfg.traversal.find_model`` API did not work properly
when passed a ``path`` argument which was unicode and contained
high-order bytes when the ``unicode_path_segments`` or
``BFG_UNICODE_PATH_SEGMENTS`` configuration variables were "true".

- A new module was added: ``repoze.bfg.settings``. This contains
deployment-settings-related code.

Implementation Changes
----------------------

- The ``make_app`` callable within ``repoze.bfg.router`` now registers
the ``root_policy`` argument as a utility (unnamed, using the new
``repoze.bfg.interfaces.IRootFactory`` as a provides interface)
rather than passing it as the first argument to the
``repoze.bfg.router.Router`` class. As a result, the
``repoze.bfg.router.Router`` router class only accepts a single
argument: ``registry``. The ``repoze.bfg.router.Router`` class
retrieves the root policy via a utility lookup now. The
``repoze.bfg.router.make_app`` API also now performs some important
application registrations that were previously handled inside
``repoze.bfg.registry.makeRegistry``.

New Modules
-----------

- A ``repoze.bfg.settings`` module was added. It contains code
related to deployment settings. Most of the code it contains was
moved to it from the ``repoze.bfg.registry`` module.

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

- The ``repoze.bfg.settings.Settings`` class (an instance of which is
registered as a utility providing
``repoze.bfg.interfaces.ISettings`` when any application is started)
now automatically calls ``repoze.bfg.settings.get_options`` on the
options passed to its constructor. This means that usage of
``get_options`` within an application's ``make_app`` function is no
longer required (the "raw" ``options`` dict or None may be passed).

- Remove old cold which attempts to recover from trying to unpickle a
``z3c.pt`` template; Chameleon has been the templating engine for a
good long time now. Running repoze.bfg against a sandbox that has
pickled ``z3c.pt`` templates it will now just fail with an
unpickling error, but can be fixed by deleting the template cache
files.

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

- Moved the ``repoze.bfg.registry.Settings`` class. This has been
moved to ``repoze.bfg.settings.Settings``. A deprecation warning is
issued when it is imported from the older location.

- Moved the ``repoze.bfg.registry.get_options`` function This has been
moved to ``repoze.bfg.settings.get_options``. A deprecation warning
is issued when it is imported from the older location.

- The ``repoze.bfg.interfaces.IRootPolicy`` interface was renamed
within the interfaces package. It has been renamed to
``IRootFactory``. A deprecation warning is issued when it is
imported from the older location.

0.6.1

==================

New Modules
-----------

- A new module ``repoze.bfg.url`` has been added. It contains the
``model_url`` API (moved from ``repoze.bfg.traversal``) and an
implementation of ``urlencode`` (like Python's
``urllib.urlencode``) which can handle Unicode keys and values in
parameters to the ``query`` argument.

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

- The ``model_url`` function has been moved from
``repoze.bfg.traversal`` into ``repoze.bfg.url``. It can still
be imported from ``repoze.bfg.traversal`` but an import from
``repoze.bfg.traversal`` will emit a DeprecationWarning.

Features
--------

- A ``static`` helper class was added to the ``repoze.bfg.views``
module. Instances of this class are willing to act as BFG views
which return static resources using files on disk. See the
``repoze.bfg.view`` docs for more info.

- The ``repoze.bfg.url.model_url`` API (nee'
``repoze.bfg.traversal.model_url``) now accepts and honors a
keyword argument named ``query``. The value of this argument
will be used to compose a query string, which will be attached to
the generated URL before it is returned. See the API docs (in
the docs directory or on the web
``http://static.repoze.org/bfgdocs``) (broken URL) for more information.

Page 23 of 30

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.