From d809ac74d19342bcc84e4fe043697709b2001cc0 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 30 Jun 2009 21:02:00 +0000 Subject: - Add a ``reload_resources`` configuration file setting (aka the ``BFG_RELOAD_RESOURCES`` environment variable). When this is set to true, the server never needs to be restarted when moving files between directory resource overrides (esp. for templates currently). - Add a ``reload_all`` configuration file setting (aka the ``BFG_RELOAD_ALL`` environment variable) that implies both ``reload_resources`` and ``reload_templates``. - The ``static`` helper view class now uses a ``PackageURLParser`` in order to allow for the overriding of static resources (CSS / logo files, etc) using the ``resource`` ZCML directive. The ``PackageURLParser`` class was added to a (new) ``static`` module in BFG; it is a subclass of the ``StaticURLParser`` class in ``paste.urlparser``. - The ``repoze.bfg.templating.renderer_from_cache`` function now checks for the ``reload_resources`` setting; if it's true, it does not register a template renderer (it won't use the registry as a template renderer cache). - Add ``pkg_resources`` to the glossary. - Update the "Environment" docs to note the existence of ``reload_resources`` and ``reload_all``. - Use a colon instead of a tab as the separator between package name and relpath to form the "spec" when register a ITemplateRenderer. --- repoze/bfg/tests/test_settings.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'repoze/bfg/tests/test_settings.py') diff --git a/repoze/bfg/tests/test_settings.py b/repoze/bfg/tests/test_settings.py index 903a23f5d..8319a302d 100644 --- a/repoze/bfg/tests/test_settings.py +++ b/repoze/bfg/tests/test_settings.py @@ -61,6 +61,42 @@ class TestGetOptions(unittest.TestCase): {'BFG_RELOAD_TEMPLATES':'1'}) self.assertEqual(result['reload_templates'], True) + def test_reload_resources(self): + result = self._callFUT({}) + self.assertEqual(result['reload_resources'], False) + result = self._callFUT({'reload_resources':'false'}) + self.assertEqual(result['reload_resources'], False) + result = self._callFUT({'reload_resources':'t'}) + self.assertEqual(result['reload_resources'], True) + result = self._callFUT({'reload_resources':'1'}) + self.assertEqual(result['reload_resources'], True) + result = self._callFUT({}, {'BFG_RELOAD_RESOURCES':'1'}) + self.assertEqual(result['reload_resources'], True) + result = self._callFUT({'reload_resources':'false'}, + {'BFG_RELOAD_RESOURCES':'1'}) + self.assertEqual(result['reload_resources'], True) + + def test_reload_all(self): + result = self._callFUT({}) + self.assertEqual(result['reload_templates'], False) + self.assertEqual(result['reload_resources'], False) + result = self._callFUT({'reload_all':'false'}) + self.assertEqual(result['reload_templates'], False) + self.assertEqual(result['reload_resources'], False) + result = self._callFUT({'reload_all':'t'}) + self.assertEqual(result['reload_templates'], True) + self.assertEqual(result['reload_resources'], True) + result = self._callFUT({'reload_all':'1'}) + self.assertEqual(result['reload_templates'], True) + self.assertEqual(result['reload_resources'], True) + result = self._callFUT({}, {'BFG_RELOAD_ALL':'1'}) + self.assertEqual(result['reload_templates'], True) + self.assertEqual(result['reload_resources'], True) + result = self._callFUT({'reload_all':'false'}, + {'BFG_RELOAD_ALL':'1'}) + self.assertEqual(result['reload_templates'], True) + self.assertEqual(result['reload_resources'], True) + def test_debug_authorization(self): result = self._callFUT({}) self.assertEqual(result['debug_authorization'], False) -- cgit v1.2.3