summaryrefslogtreecommitdiff
path: root/docs/narr
AgeCommit message (Collapse)Author
2009-05-28Docs for Windows people, add paster to index.Chris McDonough
2009-05-27Rendering.Chris McDonough
2009-05-27Don't mix the streams.Chris McDonough
2009-05-27(no commit message)Chris McDonough
2009-05-27(no commit message)Chris McDonough
2009-05-27From jpenny.Chris McDonough
2009-05-27- A paster command has been added named "bfgshell". This command canChris McDonough
be used to get an interactive prompt with your BFG root object in the global namespace. E.g.:: bin/paster bfgshell /path/to/myapp.ini myapp See the ``Project`` chapter in the BFG documentation for more information.
2009-05-27Merge authchanges branch to trunk.Chris McDonough
2009-05-26Revert all work towards creating a "forbidden" API on the security policy; ↵Chris McDonough
I'll do this work on the authchanges branch first.
2009-05-25IForbiddenAppFactory -> IForbiddenResponseFactory.Chris McDonough
2009-05-25Change the semantics of IForbiddenAppFactory.Chris McDonough
2009-05-24FeaturesChris McDonough
-------- - It is now possible to write a custom security policy that returns a customized ``Forbidden`` WSGI application when BFG cannot authorize an invocation of a view. To this end, ISecurityPolicy objects must now have a ``forbidden`` method. This method should return a WSGI application. The returned WSGI application should generate a response which is appropriate when access to a view resource was forbidden by the security policy (e.g. perhaps a login page). ``repoze.bfg`` is willing to operate with a custom security policy that does not have a ``forbidden`` method, but it will issue a warning; eventually security policies without a ``forbidden`` method will cease to work under ``repoze.bfg``. Note that the ``forbidden`` WSGI application returned by the security policy is not used if a developer has registered an IForbiddenAppFactory (see the "Hooks" narrative chapter); the explicitly registered IForbiddenAppFactory will be preferred over the (more general) security policy forbidden app factory. - All default security policies now have a ``forbidden`` callable attached to them. This particular callable returns a WSGI application which generates a ``401 Unauthorized`` response for backwards compatibility (had backwards compatibility not been an issue, this callable would have returned a WSGI app that generated a ``403 Forbidden`` response). Backwards Incompatibilities --------------------------- - Custom NotFound and Forbidden (nee' Unauthorized) WSGI applications (registered a a utility for INotFoundAppFactory and IUnauthorizedAppFactory) could rely on an environment key named ``message`` describing the circumstance of the response. This key has been renamed to ``repoze.bfg.message`` (as per the WSGI spec, which requires environment extensions to contain dots). Deprecations ------------ - The ``repoze.bfg.interfaces.IUnauthorizedAppFactory`` interface has been renamed to ``repoze.bfg.interfaces.IForbiddenAppFactory``.
2009-05-22Tweak.Chris McDonough
2009-05-22Tweak.Chris McDonough
2009-05-22Tweak.Chris McDonough
2009-05-22Import fix.Chris McDonough
2009-05-22Expand.Chris McDonough
2009-05-22note->warning.Chris McDonough
2009-05-21Tweaks.Chris McDonough
2009-05-21Disambiguate.Chris McDonough
2009-05-21Disambiguate.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-21- Removed the pickling of ZCML actions (the code that wroteChris McDonough
``configure.zcml.cache`` next to ``configure.zcml`` files in projects). The code which managed writing and reading of the cache file was a source of subtle bugs when users switched between imperative (e.g. ``@bfg_view``) registrations and declarative registrations (e.g. the ``view`` directive in ZCML) on the same project. On a moderately-sized project (535 ZCML actions and 15 ZCML files), executing actions read from the pickle was saving us only about 200ms (2.5 sec vs 2.7 sec average). On very small projects (1 ZCML file and 4 actions), startup time was comparable, and sometimes even slower when reading from the pickle, and both ways were so fast that it really just didn't matter anyway.
2009-05-16``get_options`` no longer exists.Chris McDonough
2009-05-16Speed up common case (use default factory).Chris McDonough
2009-05-16These are useless to explain; I don't even understand them.Chris McDonough
2009-05-16Remove non-sequitur.Chris McDonough
2009-05-16- The ``RoutesMapper`` class in ``repoze.bfg.urldispatch`` has beenChris McDonough
removed, as well as its documentation. It had been deprecated since 0.6.3. Code in ``repoze.bfg.urldispatch.RoutesModelTraverser`` which catered to it has also been removed. - The semantics of the ``route`` ZCML directive have been simplified. Previously, it was assumed that to use a route, you wanted to map a route to an externally registered view. The new ``route`` directive instead has a ``view`` attribute which is required, specifying the dotted path to a view callable. When a route directive is processed, a view is *registered* using the name attribute of the route directive as its name and the callable as its value. The ``view_name`` and ``provides`` attributes of the ``route`` directive are therefore no longer used. Effectively, if you were previously using the ``route`` directive, it means you must change a pair of ZCML directives that look like this:: <route name="home" path="" view_name="login" factory=".models.root.Root" /> <view for=".models.root.Root" name="login" view=".views.login_view" /> To a ZCML directive that looks like this:: <route name="home" path="" view=".views.login_view" factory=".models.root.Root" /> In other words, to make old code work, remove the ``view`` directives that were only there to serve the purpose of backing ``route`` directives, and move their ``view=`` attribute into the ``route`` directive itself. This change also necessitated that the ``name`` attribute of the ``route`` directive is now required. If you were previously using ``route`` directives without a ``name`` attribute, you'll need to add one (the name is arbitrary, but must be unique among all ``route`` and ``view`` statements). The ``provides`` attribute of the ``route`` directive has also been removed. This directive specified a sequence of interface types that the generated context would be decorated with. Since route views are always generated now for a single interface (``repoze.bfg.IRoutesContext``) as opposed to being looked up arbitrarily, there is no need to decorate any context to ensure a view is found. - The Routes ``Route`` object used to resolve the match is now put into the environment as ``bfg.route`` when URL dispatch is used.
2009-05-14Rendering.Chris McDonough
2009-05-14General cleanup.Chris McDonough
2009-05-14Update test coverage output.Chris McDonough
2009-05-14- Update "Templates" narrative chapter in docs (expand to show aChris McDonough
sample template and correct macro example).
2009-05-14- Noted existence of ``repoze.bfg.pagetemplate`` template bindings inChris McDonough
"Available Add On Template System Bindings" in Templates chapter in narrative docs. - Noted existence of ``alchemy`` paster template.
2009-05-11- Added a ``routesalchemy`` Paster template. This paster templateChris McDonough
sets up a BFG project that uses SQAlchemy (with SQLite) and uses Routes exclusively to resolve URLs (no traversal root factory is used). This template can be used via ``paster create -t bfg_routesalchemy``.
2009-05-10Docs tweaks.Chris McDonough
2009-05-10- Added documentation to the URL Dispatch chapter about how to performChris McDonough
a cleanup function at the end of a request (e.g. close the SQL connection).
2009-05-10- Added documentation to the URL Dispatch chapter about how to catchChris McDonough
the root URL.
2009-05-06FeaturesChris McDonough
-------- - Two new security policies were added: RemoteUserInheritingACLSecurityPolicy and WhoInheritingACLSecurityPolicy. These are security policies which take into account *all* ACLs defined in the lineage of a context rather than stopping at the first ACL found in a lineage. See the "Security" chapter of the API documentation for more information. - The API and narrative documentation dealing with security was changed to introduce the new "inheriting" security policy variants. - Added glossary entry for "lineage". Deprecations ------------ - The security policy previously named ``RepozeWhoIdentityACLSecurityPolicy`` now has the slightly saner name of ``WhoACLSecurityPolicy``. A deprecation warning is emitted when this policy is imported under the "old" name; usually this is due to its use in ZCML within your application. If you're getting this deprecation warning, change your ZCML to use the new name, e.g. change:: <utility provides="repoze.bfg.interfaces.ISecurityPolicy" factory="repoze.bfg.security.RepozeWhoIdentityACLSecurityPolicy" /> To:: <utility provides="repoze.bfg.interfaces.ISecurityPolicy" factory="repoze.bfg.security.WhoACLSecurityPolicy" />
2009-05-06Update nosetest output.Chris McDonough
2009-05-05- Applications which rely on ``zope.testing.cleanup.cleanUp` in unitChris McDonough
tests can still use that function indefinitely. However, for maximum forward compatibility, they should import ``cleanUp`` from ``repoze.bfg.testing`` instead of from ``zope.testing.cleanup``. The BFG paster templates and docs have been changed to use this function instead of the ``zope.testing.cleanup`` version.
2009-05-01Merge "c-free" branch to trunk.Chris McDonough
2009-05-01Prep for 0.7.1 release.Chris McDonough
2009-05-01- In previous releases, the ``repoze.bfg.url.model_url``,Chris McDonough
``repoze.bfg.traversal.model_path`` and ``repoze.bfg.traversal.model_path_tuple`` functions always ignored the ``__name__`` argument of the root object in a model graph ( effectively replacing it with a leading ``/`` in the returned value) when a path or URL was generated. The code required to perform this operation was not efficient. As of this release, the root object in a model graph *must* have a ``__name__`` attribute that is either ``None`` or the empty string (``''``) for URLs and paths to be generated properly from these APIs. If your root model object has a ``__name__`` argument that is not one of these values, you will need to change your code for URLs and paths to be generated properly. If your model graph has a root node with a string ``__name__`` that is not null, the value of ``__name__`` will be prepended to every path and URL generated.
2009-05-01- The ``repoze.bfg.location.LocationProxy`` class and theChris McDonough
``repoze.bfg.location.ClassAndInstanceDescr`` class have both been removed in order to be able to eventually shed a dependency on ``zope.proxy``. Neither of these classes was ever an API. - In all previous releases, the ``repoze.bfg.location.locate`` function worked like so: if a model did not explicitly provide the ``repoze.bfg.interfaces.ILocation`` interface, ``locate`` returned a ``LocationProxy`` object representing ``model`` with its ``__parent__`` attribute assigned to ``parent`` and a ``__name__`` attribute assigned to ``__name__``. In this release, the ``repoze.bfg.location.locate`` function simply jams the ``__name__`` and ``__parent__`` attributes on to the supplied model unconditionally, no matter if the object implements ILocation or not, and it never returns a proxy. This was done because the LocationProxy behavior has now moved into an add-on package (``repoze.bfg.traversalwrapper``), in order to eventually be able to shed a dependency on ``zope.proxy``. - In all previous releases, by default, if traversal was used (as opposed to URL-dispatch), and the root object supplied the``repoze.bfg.interfaces.ILocation`` interface, but the children returned via its ``__getitem__`` returned an object that did not implement the same interface, :mod:`repoze.bfg` provided some implicit help during traversal. This traversal feature wrapped subobjects from the root (and thereafter) that did not implement ``ILocation`` in proxies which automatically provided them with a ``__name__`` and ``__parent__`` attribute based on the name being traversed and the previous object traversed. This feature has now been removed from the base ``repoze.bfg`` package for purposes of eventually shedding a dependency on ``zope.proxy``. In order to re-enable the wrapper behavior for older applications which cannot be changed, register the "traversalwrapper" ``ModelGraphTraverser`` as the traversal policy, rather than the default ``ModelGraphTraverser``. To use this feature, you will need to install the ``repoze.bfg.traversalwrapper`` package (an add-on package, available at http://svn.repoze.org/repoze.bfg.traversalwrapper) Then change your application's ``configure.zcml`` to include the following stanza: <adapter factory="repoze.bfg.traversalwrapper.ModelGraphTraverser" provides="repoze.bfg.interfaces.ITraverserFactory" for="*" /> When this ITraverserFactory is used instead of the default, no object in the graph (even the root object) must supply a ``__name__`` or ``__parent__`` attribute. Even if subobjects returned from the root *do* implement the ILocation interface, these will still be wrapped in proxies that override the object's "real" ``__parent__`` and ``__name__`` attributes. See also changes to the "Models" chapter of the documentation (in the "Location-Aware Model Instances") section.
2009-05-01Note new index location for BFG.Chris McDonough
2009-04-30Remove incorrect info from security chapter.Chris McDonough
2009-04-30Make ModelGraphTraverser assume that all traversed objects provide ↵Chris McDonough
ILocation. Make WrappingModelGraphTraverser assume that *no* traversed objects provide ILocation. This makes it unnecessary to explain why the root object in a WrappingModelGraphTraverser setup needs to supply the ILocation interface. Now it doesn't.
2009-04-29Drop the ILocation testing by default during traversal.Tres Seaver
2009-04-18- Added better documentation for virtual hosting at a URL prefixChris McDonough
within the virtual hosting docs chapter.
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.