diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-07-02 01:47:47 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-07-02 01:47:47 +0000 |
| commit | b29429e470c093573f3735b0dbf09d42c29cfe4d (patch) | |
| tree | 8dfa266de6bd0f10a80d9654fe3ddf3a7897c467 /repoze/bfg/tests/test_zcml.py | |
| parent | 78a659d76e5bbb7544212174f010c1f50f8bcbe6 (diff) | |
| download | pyramid-b29429e470c093573f3735b0dbf09d42c29cfe4d.tar.gz pyramid-b29429e470c093573f3735b0dbf09d42c29cfe4d.tar.bz2 pyramid-b29429e470c093573f3735b0dbf09d42c29cfe4d.zip | |
- The ``repoze.bfg.url.route_url`` API has changed. If a keyword
``_app_url`` is present in the arguments passed to ``route_url``,
this value will be used as the protocol/hostname/port/leading path
prefix of the generated URL. For example, using an ``_app_url`` of
``http://example.com:8080/foo`` would cause the URL
``http://example.com:8080/foo/fleeb/flub`` to be returned from this
function if the expansion of the route pattern associated with the
``route_name`` expanded to ``/fleeb/flub``.
- It is now possible to use a URL as the ``name`` argument fed to
``repoze.bfg.configuration.Configurator.add_static_view``. When the
name argument is a URL, the ``repoze.bfg.url.static_url`` API will
generate join this URL (as a prefix) to a path including the static
file name. This makes it more possible to put static media on a
separate webserver for production, while keeping static media
package-internal and served by the development webserver during
development.
Diffstat (limited to 'repoze/bfg/tests/test_zcml.py')
| -rw-r--r-- | repoze/bfg/tests/test_zcml.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py index 0c8cccb06..d7282551d 100644 --- a/repoze/bfg/tests/test_zcml.py +++ b/repoze/bfg/tests/test_zcml.py @@ -683,11 +683,11 @@ class TestStaticDirective(unittest.TestCase): from repoze.bfg.zcml import static return static(*arg, **kw) - def test_it(self): + def test_it_with_slash(self): from repoze.bfg.static import PackageURLParser from repoze.bfg.threadlocal import get_current_registry from zope.interface import implementedBy - from repoze.bfg.static import StaticRootFactory + from repoze.bfg.static import StaticURLInfo from repoze.bfg.interfaces import IView from repoze.bfg.interfaces import IViewClassifier from repoze.bfg.interfaces import IRouteRequest @@ -701,9 +701,8 @@ class TestStaticDirective(unittest.TestCase): route_action = actions[0] discriminator = route_action['discriminator'] - self.assertEqual(discriminator, - ('route', 'name', False, None, None, None, None, None)) - route_action['callable'](*route_action['args']) + self.assertEqual(discriminator, ('static', 'name')) + route_action['callable'](*route_action['args'], **route_action['kw']) mapper = reg.getUtility(IRoutesMapper) routes = mapper.get_routes() self.assertEqual(len(routes), 1) @@ -712,16 +711,15 @@ class TestStaticDirective(unittest.TestCase): view_action = actions[1] discriminator = view_action['discriminator'] - self.assertEqual(discriminator[:3], ('view', StaticRootFactory, '')) + self.assertEqual(discriminator[:3], ('view', StaticURLInfo, '')) self.assertEqual(discriminator[4], IView) - iface = implementedBy(StaticRootFactory) + iface = implementedBy(StaticURLInfo) request_type = reg.getUtility(IRouteRequest, 'name') view = reg.adapters.lookup( (IViewClassifier, request_type, iface), IView, name='') request = DummyRequest() self.assertEqual(view(None, request).__class__, PackageURLParser) - class TestResourceDirective(unittest.TestCase): def setUp(self): testing.setUp() |
