From e62e479e338e428f6cfd3b07790545982b7cb94f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 27 Jan 2009 21:57:11 +0000 Subject: Features -------- - 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``. --- repoze/bfg/interfaces.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'repoze/bfg/interfaces.py') diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index 7d4286ca3..80a6bda26 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -201,8 +201,14 @@ class IUnauthorizedAppFactory(Interface): ``message`` key in the WSGI environ provides information pertaining to the reason for the unauthorized.""" -class IURLGenerator(Interface): - """ A utility which provides virtual hosting services +class IContextURL(Interface): + """ An adapter which deals with URLs related to a context. """ - def model_url(model, request): - """ Return a URL that points to the model """ + def virtual_root(): + """ Return the virtual root related to a request and the + current context""" + + def __call__(): + """ Return a URL that points to the context """ + +VH_ROOT_KEY = 'HTTP_X_VHM_ROOT' -- cgit v1.2.3