summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_integration.py
AgeCommit message (Collapse)Author
2010-10-25first pass at converting bfg to pyramid namespaceChris McDonough
2010-04-18- Use "Venusian" (`http://docs.repoze.org/venusianChris McDonough
<http://docs.repoze.org/venusian>`) to perform ``bfg_view`` decorator scanning rather than relying on a BFG-internal decorator scanner. (Truth be told, Venusian is really just a generalization of the BFG-internal decorator scanner). - A new install-time dependency on the ``venusian`` distribution was added. - Remove ``repoze.bfg.compat.pkgutil_26.py`` and import alias ``repoze.bfg.compat.walk_packages``. These were only required by internal scanning machinery; Venusian replaced the internal scanning machinery, so these are no longer required.
2010-04-14Add "exception views" work contributed primarily by Andrey Popp by merging ↵Chris McDonough
the "phash" branch.
2010-02-04- Fix a bug whereby a ``renderer`` argument to the ``@bfg_view``Chris McDonough
decorator that provided a package-relative template filename might not have been resolved properly. Symptom: inappropriate ``Missing template resource`` errors.
2010-02-04- 1.2b4 introduced a bug whereby views added via a route configurationChris McDonough
that named a view callable and also a ``view_attr`` became broken. Symptom: ``MyViewClass is not callable`` or the ``__call__`` of a class was being called instead of the method named via ``view_attr``.
2010-01-24Make sure global views don't match by default.Chris McDonough
2010-01-24Merge reversepolarity branch.Chris McDonough
2010-01-20Add (non-failing) tests for ordering issue reported indirectly via ↵Chris McDonough
http://labs.creativecommons.org/2010/01/13/cc-engine-and-web-non-frameworks/ .. can't seem to repeat.
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-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).
2009-11-27Coverage.Chris McDonough
Remove set_security_policies configurator API method.
2009-11-25- Replace martian with something simpler.Chris McDonough
2009-11-23Disuse ZCA threadlocal API.Chris McDonough
2009-11-19- Each of the ``repoze.bfg.view.render_view``,Chris McDonough
``repoze.bfg.view.render_view_to_iterable``, ``repoze.bfg.view.render_view_to_response``, ``repoze.bfg.view.append_slash_notfound_view``, ``repoze.bfg.view.default_notfound_view``, ``repoze.bfg.view.default_forbidden_view``, and the ``repoze.bfg.configuration.rendered_response`` functions now expects to be called with a request object that has a ``registry`` attribute which represents the current ZCA registry. This should only be a problem when passing a custom request object to code which ends up calling these functions in a unit test. To retrofit tests that end up calling these functions which expect to be able to use a non-registry-aware request object, use the ``repoze.bfg.threadlocal.get_current_request`` API in the test to create the request; this will return a ``repoze.bfg.testing.DummyRequest`` that has the current registry as its ``registry`` attribute. Alternatively, use the ``repoze.bfg.threadlocal.get_current_registry`` API: call this function and add an attribute to your unit test request object named ``registry`` with the result. - The ``repoze.bfg.view.derive_view`` callable has been removed. Use ``repoze.bfg.configuration.Configurator.derive_view`` instead (still not an API, however).
2009-11-17Move configuration methods into Configurator.Chris McDonough
2009-11-16Merge imperativeconfig branch.Chris McDonough
2009-10-18- The ``@bfg_view`` decorator can now be used against a class method::Chris McDonough
from webob import Response from repoze.bfg.view import bfg_view class MyView(object): def __init__(self, context, request): self.context = context self.request = request @bfg_view(name='hello') def amethod(self): return Response('hello from %s!' % self.context) When the bfg_view decorator is used against a class method, a view is registered for the *class* (it's a "class view" where the "attr" happens to be the method they're attached to), so the view class must have a suitable constructor.
2009-10-18- More than one ``@bfg_view`` decorator may now be stacked on top ofChris McDonough
any number of others. Each invocation of the decorator registers a single view. For instance, the following combination of decorators and a function will register two views:: from repoze.bfg.view import bfg_view @bfg_view(name='edit') @bfg_view(name='change') def edit(context, request): pass This makes it possible to associate more than one view configuration for a single callable without requiring ZCML.
2009-09-22__is_bfg_view__ -> __bfg_view_settings__Chris McDonough
2009-09-22Fix buildbot failures by sorting view actions.Chris McDonough
2009-09-20Make instance grokking work again.Chris McDonough
2009-09-20- The way ``bfg_view`` declarations are scanned for has been modified.Chris McDonough
This should have no external effects. - An object implementing the ``IRenderer`` interface (and ``ITemplateRenderer`, which is a subclass of ``IRenderer``) must now accept an extra ``system`` argument in its ``__call__`` method implementation. Values computed by the system (as opposed to by the view) are passed by the system in the ``system`` parameter, which will always be a dictionary. Keys in the dictionary include: ``view`` (the view object that returned the value), ``renderer_name`` (the template name or simple name of the renderer), ``context`` (the context object passed to the view), and ``request`` (the request object passed to the view). Previously only ITemplateRenderers received system arguments as elements inside the main ``value`` dictionary.
2009-09-06Merge multiview2 branch to HEAD.Chris McDonough
2009-06-19Fix strange test breakage.Tres Seaver
2009-06-19Move pushpage support out into separate distribution.Tres Seaver
2009-06-11Merge unifyroutesandtraversal branch into trunkChris McDonough
2009-05-31Test string request type in bfg_view decorators.Chris McDonough
2009-05-27Merge authchanges branch to trunk.Chris McDonough
2009-05-21- Class objects may now be used as view callables (both via ZCML andChris McDonough
via use of the ``bfg_view`` decorator in Python 2.6 as a class decorator). The calling semantics when using a class as a view callable is similar to that of using a class as a Zope "browser view": the class' ``__init__`` must accept two positional parameters (conventionally named ``context``, and ``request``). The resulting instance must be callable (it must have a ``__call__`` method). When called, the instance should return a response. For example:: from webob import Response class MyView(object): def __init__(self, context, request): self.context = context self.request = request def __call__(self): return Response('hello from %s!' % self.context) See the "Views" chapter in the documentation and the ``repoze.bfg.view`` API documentation for more information.
2009-05-21Remove cacheability voodoo.Chris McDonough
2009-05-05Get rid of direct dependency on zope.testing by creating our own addCleanUp ↵Chris McDonough
and cleanUp functions in repoze.bfg.testing. Our dependencies still rely on zope.testing, however.
2009-04-29This is a bogus assertion.Chris McDonough
2009-04-16- The interface for ``repoze.bfg.interfaces.ITraverser`` and theChris McDonough
built-in implementations that implement the interface (``repoze.bfg.traversal.ModelGraphTraverser``, and ``repoze.bfg.urldispatch.RoutesModelTraverser``) now expect the ``__call__`` method of an ITraverser to return 3 additional arguments: ``traversed``, ``virtual_root``, and ``virtual_root_path`` (the old contract was that the ``__call__`` method of an ITraverser returned; three arguments, the contract new is that it returns six). ``traversed`` will be a sequence of Unicode names that were traversed (including the virtual root path, if any) or ``None`` if no traversal was performed, ``virtual_root`` will be a model object representing the virtual root (or the physical root if traversal was not performed), and ``virtual_root_path`` will be a sequence representing the virtual root path (a sequence of Unicode names) or ``None`` if traversal was not performed. Six arguments are now returned from BFG ITraversers. They are returned in this order: ``context``, ``view_name``, ``subpath``, ``traversed``, ``virtual_root``, and ``virtual_root_path``. Places in the BFG code which called an ITraverser continue to accept a 3-argument return value, although BFG will generate and log a warning when one is encountered. - The request object now has the following attributes: ``traversed`` (the sequence of names traversed or ``None`` if traversal was not performed), ``virtual_root`` (the model object representing the virtual root, including the virtual root path if any), and ``virtual_root_path`` (the seuquence of names representing the virtual root path or ``None`` if traversal was not performed). - A new decorator named ``wsgiapp2`` was added to the ``repoze.bfg.wsgi`` module. This decorator performs the same function as ``repoze.bfg.wsgi.wsgiapp`` except it fixes up the ``SCRIPT_NAME``, and ``PATH_INFO`` environment values before invoking the WSGI subapplication. - The ``repoze.bfg.testing.DummyRequest`` object now has default attributes for ``traversed``, ``virtual_root``, and ``virtual_root_path``. - The RoutesModelTraverser now behaves more like the Routes "RoutesMiddleware" object when an element in the match dict is named ``path_info`` (usually when there's a pattern like ``http://foo/*path_info``). When this is the case, the ``PATH_INFO`` environment variable is set to the value in the match dict, and the ``SCRIPT_NAME`` is appended to with the prefix of the original ``PATH_INFO`` not including the value of the new variable. - The notfound debug now shows the traversed path, the virtual root, and the virtual root path too.
2009-01-27FeaturesChris McDonough
-------- - The ``repoze.bfg.url.model_url`` API now works against contexts derived from Routes URL dispatch (``Routes.util.url_for`` is called under the hood). - "Virtual root" support for traversal-based applications has been added. Virtual root support is useful when you'd like to host some model in a :mod:`repoze.bfg` model graph as an application under a URL pathname that does not include the model path itself. For more information, see the (new) "Virtual Hosting" chapter in the documentation. - A ``repoze.bfg.traversal.virtual_root`` API has been added. When called, it returns the virtual root object (or the physical root object if no virtual root has been specified). Implementation Changes ---------------------- - ``repoze.bfg.traversal.RoutesModelTraverser`` has been moved to ``repoze.bfg.urldispatch``. - ``model_url`` URL generation is now performed via an adapter lookup based on the context and the request. - ZCML which registers two adapters for the ``IContextURL`` interface has been added to the configure.zcml in ``repoze.bfg.includes``.
2009-01-18grok -> scan to prevent confusion.Chris McDonough
2009-01-16- The ``repoze.bfg.view.static`` helper now usesChris McDonough
``webob.Request.get_response`` to do its work rather than relying on howgrown WSGI code.
2009-01-16FeaturesChris McDonough
-------- - 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 ``<grok 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). Implementation Changes ---------------------- - The ``wsgiapp`` decorator now uses ``webob.Request.get_response`` to do its work rather than relying on howgrown WSGI code.