From 3d1abbd5be1d1bc0f27e488059ccf7aaca225f31 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 25 Aug 2009 01:30:40 +0000 Subject: - The ``repoze.bfg.view.static`` class now accepts a string as its first argument ("root_dir") that represents a package-relative name e.g. ``somepackage:foo/bar/static``. This is now the preferred mechanism for spelling package-relative static paths using this class. A ``package_name`` keyword argument has been left around for backwards compatibility. If it is supplied, it will be honored. - Fixed documentation for ``repoze.bfg.view.static`` (in narrative ``Views`` chapter). --- repoze/bfg/tests/test_view.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'repoze/bfg/tests') diff --git a/repoze/bfg/tests/test_view.py b/repoze/bfg/tests/test_view.py index a35930f69..3c7d6f853 100644 --- a/repoze/bfg/tests/test_view.py +++ b/repoze/bfg/tests/test_view.py @@ -351,7 +351,23 @@ class TestStaticView(unittest.TestCase, BaseTest): def test_relpath_withpackage(self): import os path = 'fixtures' - view = self._makeOne(path, package_name='another') + view = self._makeOne('another:fixtures') + context = DummyContext() + request = DummyRequest() + request.subpath = ['__init__.py'] + request.environ = self._makeEnviron() + response = view(context, request) + self.assertEqual(request.copied, True) + here = os.path.abspath(os.path.dirname(__file__)) + self.assertEqual(response.root_resource, 'fixtures') + self.assertEqual(response.resource_name, 'fixtures') + self.assertEqual(response.package_name, 'another') + self.assertEqual(response.cache_max_age, 3600) + + def test_relpath_withpackage_name(self): + import os + path = 'fixtures' + view = self._makeOne('fixtures', package_name='another') context = DummyContext() request = DummyRequest() request.subpath = ['__init__.py'] -- cgit v1.2.3