summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2009-12-22Roles.Chris McDonough
2009-12-22Roles.Chris McDonough
2009-12-22Roles.Chris McDonough
2009-12-22Use roles.Chris McDonough
2009-12-22Use roles.Chris McDonough
2009-12-22Use roles.Chris McDonough
2009-12-22Docs.Chris McDonough
2009-12-22(no commit message)Chris McDonough
2009-12-22Use :meth:, :func:, and :class: appropriately for configuration-related docs.Chris McDonough
2009-12-21- The ``json`` renderer failed to set the response content type toChris McDonough
``application/json``. It now does, by setting ``request.response_content_type`` unless this attribute is already set. - The ``string`` renderer failed to set the response content type to ``text/plain``. It now does, by setting ``request.response_content_type`` unless this attribute is already set.
2009-12-21Wrong weight value for last predicate.Chris McDonough
2009-12-21Unused imports.Chris McDonough
2009-12-21Use renderer.Chris McDonough
2009-12-20- Add a ``**kw`` arg to the ``Configurator.add_settings`` API.Chris McDonough
2009-12-20Use add_route for testing.registerRoute.Chris McDonough
2009-12-20Prep for 1.2a7.Chris McDonough
2009-12-20Document presence of the registry attribute.Chris McDonough
2009-12-20Removed.Chris McDonough
2009-12-20(no commit message)Chris McDonough
2009-12-20Get rid of add_adapter and add_utility APIs (config.registry.registerAdapter ↵Chris McDonough
and config.registry.registerUtility will work).
2009-12-20Fix tutorial as per bug noticed by Neill Cox.Chris McDonough
2009-12-20H.Chris McDonough
2009-12-19Revise unittesting documentation to use new configurator APIs.Chris McDonough
2009-12-19- Add four new testing-related APIs to theChris McDonough
``repoze.bfg.configuration.Configurator`` class: ``testing_securitypolicy``, ``testing_models``, ``testing_add_subscriber``, and ``testing_add_template``. These were added in order to provide more direct access to the functionality of the ``repoze.bfg.testing`` APIs named ``registerDummySecurityPolicy``, ``registerModels``, ``registerEventListener``, and ``registerTemplateRenderer`` when a configurator is used. The ``testing`` APIs named are nominally deprecated (although they will likely remain around "forever", as they are in heavy use in the wild). - Doc-deprecated most helper functions in the ``repoze.bfg.testing`` module. These helper functions likely won't be removed any time soon, nor will they generate a warning any time soon, due to their heavy use in the wild, but equivalent behavior exists in methods of a Configurator.
2009-12-19- Add a new API to the ``repoze.bfg.configuration.Configurator``Chris McDonough
class: ``add_settings``. This API can be used to add "settings" (information returned within via the ``repoze.bfg.settings.get_settings`` API) after the configurator has been initially set up. This is most useful for testing purposes.
2009-12-19Add notes about nominal deprecations.Chris McDonough
2009-12-19- Add two new APIs to the ``repoze.bfg.configuration.Configurator``Chris McDonough
class: ``add_adapter`` and ``add_utility``. These, respectively, perform the same functions as the ``registerAdapter`` and ``registerUtility`` functions of a ZCA registry. They were added to allow for a more consistent testing API for applications that make use of the ZCA directly. - Cause the ``adapter``, ``utility``, and ``subscriber`` ZCML directives to use a ``Configurator`` instance and associated configurator APIs rather than a ZCA registry directly.
2009-12-19Wording.Chris McDonough
2009-12-19Wording.Chris McDonough
2009-12-19Note insertion version.Chris McDonough
2009-12-19More docs.Chris McDonough
2009-12-19- Add a ``custom_predicates`` argument to the ``Configurator``Chris McDonough
``add_view`` method, the ``bfg_view`` decorator and the attribute list of the ZCML ``view`` directive. If ``custom_predicates`` is specified, it must be a sequence of predicate callables (a predicate callable accepts two arguments: ``context`` and ``request`` and returns ``True`` or ``False``). The associated view callable will only be invoked if all custom predicates return ``True``. Use one or more custom predicates when no existing predefined predicate is useful. Predefined and custom predicates can be mixed freely. - Add a ``custom_predicates`` argument to the ``Configurator`` ``add_route`` and the attribute list of the ZCML ``route`` directive. If ``custom_predicates`` is specified, it must be a sequence of predicate callables (a predicate callable accepts two arguments: ``context`` and ``request`` and returns ``True`` or ``False``). The associated route will match will only be invoked if all custom predicates return ``True``, else route matching continues. Use one or more custom predicates when no existing predefined predicate is useful. Predefined and custom predicates can be mixed freely.
2009-12-18Prep for 1.2a6.Chris McDonough
2009-12-17FeaturesChris McDonough
-------- - The ``Configurator`` object now has two new methods: ``begin`` and ``end``. The ``begin`` method is meant to be called before any "configuration" begins (e.g. before ``add_view``, et. al are called). The ``end`` method is meant to be called after all "configuration" is complete. Previously, before there was imperative configuration at all (1.1 and prior), configuration begin and end was invariably implied by the process of loading a ZCML file. When a ZCML load happened, the threadlocal data structure containing the request and registry was modified before the load, and torn down after the load, making sure that all framework code that needed ``get_current_registry`` for the duration of the ZCML load was satisfied. Some API methods called during imperative configuration, (such as ``Configurator.add_view`` when a renderer is involved) end up for historical reasons calling ``get_current_registry``. However, in 1.2a5 and below, the Configurator supplied no functionality that allowed people to make sure that ``get_current_registry`` returned the registry implied by the configurator being used. ``begin`` now serves this purpose. Inversely, ``end`` pops the thread local stack, undoing the actions of ``begin``. We make this boundary explicit to reduce the potential for confusion when the configurator is used in different circumstances (e.g. in unit tests and app code vs. just in initial app setup). Existing code written for 1.2a1-1.2a5 which does not call ``begin`` or ``end`` continues to work in the same manner it did before. It is however suggested that this code be changed to call ``begin`` and ``end`` to reduce the potential for confusion in the future. - All ``paster`` templates which generate an application skeleton now make use of the new ``begin`` and ``end`` methods of the Configurator they use in their respective copies of ``run.py`` and ``tests.py``. Documentation ------------- - All documentation that makes use of a ``Configurator`` object to do application setup and test setup now makes use of the new ``begin`` and ``end`` methods of the configurator. Bug Fixes --------- - When a ``repoze.bfg.exceptions.NotFound`` or ``repoze.bfg.exceptions.Forbidden`` *class* (as opposed to instance) was raised as an exception within a root factory (or route root factory), the exception would not be caught properly by the ``repoze.bfg.`` Router and it would propagate to up the call stack, as opposed to rendering the not found view or the forbidden view as would have been expected.
2009-12-17Comment.Chris McDonough
2009-12-17(no commit message)Chris McDonough
2009-12-17- When Chameleon page or text templates were added imperatively (viaChris McDonough
``Configurator.add_view`` or some derivative), they too-eagerly attempted to look up the ``reload_templates`` setting via ``get_settings``, meaning they were always registered in non-auto-reload-mode (the default). Each now waits until its respective ``template`` attribute is accessed to look up the value.
2009-12-16Bug FixesChris McDonough
--------- - When a route with the same name as a previously registered route was added, the old route was not removed from the mapper's routelist. Symptom: the old registered route would be used (and possibly matched) during route lookup when it should not have had a chance to ever be used.
2009-12-11Fix typos pointed out by Steve Schmechel.Chris McDonough
2009-12-10Rendering.Chris McDonough
2009-12-10Prep for 1.2a5.Chris McDonough
2009-12-10- Added a "Special Exceptions" section to the "Views" narrativeChris McDonough
documentation chapter explaining the effect of raising ``repoze.bfg.exceptions.NotFound`` and ``repoze.bfg.exceptions.Forbidden`` from within view code. - When the ``repoze.bfg.exceptions.NotFound`` or ``repoze.bfg.exceptions.Forbidden`` error is raised from within a custom root factory or the ``factory`` of a route, the appropriate response is now sent to the requesting user agent (the result of the notfound view or the forbidden view, respectively). When these errors are raised from within a root factory, the ``context`` passed to the notfound or forbidden view will be ``None``. Also, the request will not be decorated with ``view_name``, ``subpath``, ``context``, etc. as would normally be the case if traversal had been allowed to take place.
2009-12-10(no commit message)Chris McDonough
2009-12-10Docs.Chris McDonough
2009-12-10Fix overriding renderers rendering.Chris McDonough
2009-12-10typoFernando Correa Neto
2009-12-09typoFernando Correa Neto
2009-12-09typoFernando Correa Neto
2009-12-09typoFernando Correa Neto
2009-12-09- A new dependency on the ``twill`` package was added to theChris McDonough
``setup.py`` ``tests_require`` argument (Twill will only be downloaded when :mod:`repoze.bfg` ``setup.py test`` or ``setup.py nosetests`` is invoked).