summaryrefslogtreecommitdiff
path: root/repoze
AgeCommit message (Collapse)Author
2010-10-25first pass at converting bfg to pyramid namespaceChris McDonough
2010-10-21- When a renderer factory could not be found, a misleading errorChris McDonough
message was raised if the renderer name was not a string.
2010-10-19note dotted-name-acceptanceChris McDonough
2010-10-13merge tutorialfix branchChris McDonough
2010-10-01wordingChris McDonough
2010-09-30renderingChris McDonough
2010-09-30renderingChris McDonough
2010-09-30renderingChris McDonough
2010-09-28prevent pyflakes complaintsChris McDonough
2010-09-24- The ``repoze.bfg.traversal.traversal_path`` API now eagerly attemptsChris McDonough
to encode a Unicode ``path`` into ASCII before attempting to split it and decode its segments. This is for convenience, effectively to allow a (stored-as-Unicode-in-a-database, or retrieved-as-Unicode-from-a-request-parameter) Unicode path to be passed to ``find_model``, which eventually internally uses the ``traversal_path`` function under the hood. In version 1.2 and prior, if the ``path`` was Unicode, that Unicode was split on slashes and each resulting segment value was Unicode. An inappropriate call to the ``decode()`` method of a resulting Unicode path segment could cause a ``UnicodeDecodeError`` to occur even if the Unicode representation of the path contained no 'high order' characters (it effectively did a "double decode"). By converting the Unicode path argument to ASCII before we attempt to decode and split, genuine errors will occur in a more obvious place while also allowing us to handle (for convenience) the case that it's a Unicode representation formed entirely from ASCII-compatible characters.
2010-09-15coverageChris McDonough
2010-09-15FeaturesChris McDonough
-------- - Compatibility with WebOb 1.0. Requirements ------------ - Now requires WebOb >= 1.0. Backwards Incompatibilities --------------------------- - Due to changes introduced WebOb 1.0, the ``repoze.bfg.request.make_request_ascii`` event subscriber no longer works, so it has been removed. This subscriber was meant to be used in a deployment so that code written before BFG 0.7.0 could run unchanged. At this point, such code will need to be rewritten to expect Unicode from ``request.GET``, ``request.POST`` and ``request.params`` or it will need to be changed to use ``request.str_POST``, ``request.str_GET`` and/or ``request.str_params`` instead of the non-``str`` versions of same, as the non-``str`` versions of the same APIs always now perform decoding to Unicode.
2010-09-14- If an exception view was registered through the legacyChris McDonough
``set_notfound_view`` or ``set_forbidden_view`` APIs, the context sent to the view was incorrect (could be ``None`` inappropriately).
2010-09-14is not NoneChris McDonough
2010-09-14- The ``add_route`` method of a Configurator now accepts aChris McDonough
``pregenerator`` argument. The pregenerator for the resulting route is called by ``route_url`` in order to adjust the set of arguments passed to it by the user for special purposes, such as Pylons 'subdomain' support. It will influence the URL returned by ``route_url``. See the ``repoze.bfg.interfaces.IRoutePregenerator`` interface for more information.
2010-09-13documentation renderingsChris McDonough
2010-09-13- Call response callbacks *after* INewResponse event.Chris McDonough
- Rearrange router logic so that start_response is not called until there is no chance of an exception occurring.
2010-09-13allow callbacks to add other callbacksChris McDonough
2010-09-13FeaturesChris McDonough
-------- - A ``request.matched_route`` attribute is now added to the request when a route has matched. Its value is the "route" object that matched (see the ``IRoute`` interface within ``repoze.bfg.interfaces`` API documentation for the API of a route object). - The ``exception`` attribute of the request is now set slightly earlier and in a slightly different set of scenarios, for benefit of "finished callbacks" and "response callbacks". In previous versions, the ``exception`` attribute of the request was not set at all if an exception view was not found. In this version, the ``request.exception`` attribute is set immediately when an exception is caught by the router, even if an exception view could not be found. Backwards Incompatibilities --------------------------- - The router no longer sets the value ``wsgiorg.routing_args`` into the environ when a route matches. The value used to be something like ``((), matchdict)``. This functionality was only ever obliquely referred to in change logs; it was never documented as an API. - The ``exception`` attribute of the request now defaults to ``None``. In prior versions, the ``request.exception`` attribute did not exist if an exception was not raised by user code during request processing; it only began existence once an exception view was found. Deprecations ------------ - References to the WSGI environment values ``bfg.routes.matchdict`` and ``bfg.routes.route`` were removed from documentation. These will stick around internally for several more releases, but it is ``request.matchdict`` and ``request.matched_route`` are now the "official" way to obtain the matchdict and the route object which resulted in the match. Documentation ------------- - Added two sections to the "Hooks" chapter of the documentation: "Using Response Callbacks" and "Using Finished Callbacks". - Added documentation of the ``request.exception`` attribute to the ``repoze.bfg.request.Request`` API documentation. - Added glossary entries for "response callback" and "finished callback". - The "Request Processing" narrative chapter has been updated to note finished and response callback steps.
2010-09-12- Add a new request API: ``request.add_finished_callback``. FinishedChris McDonough
callbacks are called by the router unconditionally near the very end of request processing.
2010-09-12remove FinishedEvent (bad idea)Chris McDonough
2010-09-12rendering:Chris McDonough
2010-09-12put exception view in glossaryChris McDonough
2010-09-12- The BFG router now emits an additional event unconditionally at theChris McDonough
end of request processing: ``repoze.bfg.interfaces.IFinishedRequest``. This event is meant to be used when it is necessary to perform unconditional cleanup after request processing. See the ``repoze.bfg.events.FinishedRequest`` class documentation for more information. - The ``repoze.bfg.interfaces.IWSGIApplicationCreatedEvent`` event interface was renamed to ``repoze.bfg.interfaces.IApplicationCreated``. Likewise, the ``repoze.bfg.events.WSGIApplicationCreatedEvent`` class was renamed to ``repoze.bfg.events.ApplicationCreated``. The older aliases will continue to work indefinitely. - The ``repoze.bfg.interfaces.IAfterTraversal`` event interface was renamed to ``repoze.bfg.interfaces.IContextFound``. Likewise, the ``repoze.bfg.events.AfterTraveral`` class was renamed to ``repoze.bfg.events.ContextFound``. The older aliases will continue to work indefinitely.
2010-09-10s/encrypt/signChris McDonough
2010-09-09FeaturesChris McDonough
-------- - In support of making it easier to configure applications which are "secure by default", a default permission feature was added. If supplied, the default permission is used as the permission string to all view registrations which don't otherwise name a permission. These APIs are in support of that: - A new constructor argument was added to the Configurator: ``default_permission``. - A new method was added to the Configurator: ``set_default_permission``. - A new ZCML directive was added: ``default_permission``. Documentation ------------- - Added documentation for the ``default_permission`` ZCML directive. - Added documentation for the ``default_permission`` constructor value and the ``set_default_permission`` method in the Configurator API documentation. - Added a new section to the "security" chapter named "Setting a Default Permission". - Document ``renderer_globals_factory`` and ``request_factory`` arguments to Configurator constructor.
2010-09-09- The ``traverse`` route predicate could not successfully generate aChris McDonough
traversal path.
2010-09-08- The ``repoze.bfg.interfaces`` API documentation page is now renderedChris McDonough
via ``repoze.sphinx.autointerface``. - The URL Dispatch narrative chapter now refers to the ``interfaces`` chapter to explain the API of an ``IRoute`` object. - ``tests_require`` now includes ``repoze.sphinx.autointerface`` as a dependency.
2010-09-08- Add an API to the ``Configurator`` named ``get_routes_mapper``.Chris McDonough
This returns an object implementing the ``IRoutesMapper`` interface.
2010-09-08- The ``repoze.bfg.urldispatch.Route`` constructor (not an API) nowChris McDonough
accepts a different ordering of arguments. Previously it was ``(pattern, name, factory=None, predicates=())``. It is now ``(name, pattern, factory=None, predicates=())``. This is in support of consistency with ``configurator.add_route``. - The ``repoze.bfg.urldispatch.RoutesMapper.connect`` method (not an API) now accepts a different ordering of arguments. Previously it was ``(pattern, name, factory=None, predicates=())``. It is now ``(name, pattern, factory=None, predicates=())``. This is in support of consistency with ``configurator.add_route``. - The ``repoze.bfg.urldispatch.RoutesMapper`` object now has a ``get_route`` method which returns a single Route object or ``None``. - A new interface ``repoze.bfg.interfaces.IRoute`` was added. The ``repoze.bfg.urldispatch.Route`` object implements this interface. - The canonical attribute for accessing the routing pattern from a route object is now ``pattern`` rather than ``path``. - The argument to ``repoze.bfg.configuration.Configurator.add_route`` which was previously called ``path`` is now called ``pattern`` for better explicability. For backwards compatibility purposes, passing a keyword argument named ``path`` to ``add_route`` will still work indefinitely. - The ``path`` attribute to the ZCML ``route`` directive is now named ``pattern`` for better explicability. The older ``path`` attribute will continue to work indefinitely. - All narrative, API, and tutorial docs which referred to a route pattern as a ``path`` have now been updated to refer to them as a ``pattern``. - The routesalchemy template has been updated to use ``pattern`` in its route declarations rather than ``path``.
2010-09-07- Prevent a race condition which could result in a ``RuntimeError``Chris McDonough
when rendering a Chameleon template that has not already been rendered once. This would usually occur directly after a restart, when more than one person or thread is trying to execute the same view at the same time: https://bugs.launchpad.net/karl3/+bug/621364
2010-09-07- Use ``hash()`` rather than ``id()`` when computing the "phash" of aChris McDonough
custom route/view predicate in order to allow the custom predicate some control over which predicates are "equal". - Use ``response.headerlist.append`` instead of ``response.headers.add`` in ``repoze.bfg.request.add_global_response_headers`` in case the response is not a WebOb response.
2010-09-07- Fix a bug in ``repoze.bfg.url.static_url`` URL generation: if twoChris McDonough
resource specifications were used to create two separate static views, but they shared a common prefix, it was possible that ``static_url`` would generate an incorrect URL. - Fix another bug in ``repoze.bfg.static_url`` URL generation: too many slashes in generated URL.
2010-09-06- Process the response callbacks and the NewResponse event earlier, toChris McDonough
enable mutations to the response to take effect.
2010-09-06renderingsChris McDonough
2010-09-06- The ``repoze.bfg.interfaces.INewResponse`` interface now includes aChris McDonough
``request`` attribute; as a result, a handler for INewResponse now has access to the request which caused the response. - The INewResponse event is now not sent to listeners if the response returned by view code (or a renderer) is not a "real" response (e.g. if it does not have ``.status``, ``.headerlist`` and ``.app_iter`` attribtues).
2010-09-05- The route pattern registered internally for a a local "static view"Chris McDonough
(either via the ``static`` ZCML directive or via the ``add_static_view`` method of the configurator) was incorrect. It was regsistered for e.g. ``static*traverse``, while it should have been registered for ``static/*traverse``. Symptom: two static views could not reliably be added to a system when they both shared the same path prefix (e.g. ``/static`` and ``/static2``).
2010-09-05renameChris McDonough
2010-09-05- Each of the follow methods of the Configurator now allow theChris McDonough
below-named arguments to be passed as "dotted name strings" (e.g. "foo.bar.baz") rather than as actual implementation objects that must be imported: setup_registry root_factory, authentication_policy, authorization_policy, debug_logger, locale_negotiator, request_factory, renderer_globals_factory add_subscriber subscriber, iface derive_view view add_view view, for_, context, request_type, containment add_route() view, view_for, factory, for_, view_context scan package add_renderer factory set_forbidden_view view set_notfound_view view set_request_factory factory set_renderer_globals_factory() factory set_locale_negotiator negotiator testing_add_subscriber event_iface
2010-09-05DocumentationChris McDonough
------------- - Add an API chapter for the ``repoze.bfg.request`` module, which includes documentation for the ``repoze.bfg.request.Request`` class (the "request object"). - Modify the "Request and Response" narrative chapter to reference the new ``repoze.bfg.request`` API chapter. Some content was moved from this chapter into the API documentation itself. Features -------- - A new ``repoze.bfg.request.Request.add_response_callback`` API has been added. This method is documented in the new ``repoze.bfg.request`` API chapter. It can be used to influence response values before a concrete response object has been created. Internal -------- - The (internal) feature which made it possible to attach a ``global_response_headers`` attribute to the request (which was assumed to contain a sequence of header key/value pairs which would later be added to the response by the router), has been removed. The functionality of ``repoze.bfg.request.Request.add_response_callback`` takes its place.
2010-08-31- The reify decorator now maintains the docstring of the function itChris McDonough
wraps.
2010-08-31docstringChris McDonough
2010-08-29Fix ReST errorWichert Akkerman
2010-08-26avoid some getattrsChris McDonough
2010-08-26the goggles, they can be replacedChris McDonough
2010-08-23docs renderingsChris McDonough
2010-08-13svn merge -r9909:HEAD $REPOZE_SVN/repoze.bfg/branches/rendererhelperChris McDonough
2010-08-13- The newChris McDonough
:meth"`repoze.bfg.configuration.Configurator.absolute_resource_spec` method resolves a potentially relative :term:`resource specification` string into an absolute version.
2010-08-13typoChris McDonough
2010-08-13- The Configurator now accepts a dotted name *string* to a package asChris McDonough
a ``package`` constructor argument. The ``package`` argument was previously required to be a package *object* (not a dotted name string). - The ``repoze.bfg.configuration.Configurator.with_package`` method was added. This method returns a new Configurator using the same application registry as the configurator object it is called upon. The new configurator is created afresh with its ``package`` constructor argument set to the value passed to ``with_package``. This feature will make it easier for future BFG versions to allow dotted names as arguments in places where currently only object references are allowed (the work to allow dotted names isntead of object references everywhere has not yet been done, however). - The ``repoze.bfg.configuration.Configurator.maybe_dotted`` method resolves a Python dotted name string supplied as its ``dotted`` argument to a global Python object. If the value cannot be resolved, a ``repoze.bfg.configuration.ConfigurationError`` is raised. If the value supplied as ``dotted`` is not a string, the value is returned unconditionally without any resolution attempted.