diff options
| author | Chris McDonough <chrism@plope.com> | 2010-10-29 17:15:01 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-10-29 17:15:01 -0400 |
| commit | cba2e1b549bf97333c155c4ca87860811dd4d2ef (patch) | |
| tree | 41af9fb8c17c2e8b8eeb2fe4fdeb973e74f86e60 | |
| parent | fb52920afd55fc5221514502249d540c7e94e043 (diff) | |
| download | pyramid-cba2e1b549bf97333c155c4ca87860811dd4d2ef.tar.gz pyramid-cba2e1b549bf97333c155c4ca87860811dd4d2ef.tar.bz2 pyramid-cba2e1b549bf97333c155c4ca87860811dd4d2ef.zip | |
bfg-> pyramid
| -rw-r--r-- | CHANGES.txt | 3 | ||||
| -rw-r--r-- | TODO.txt | 16 | ||||
| -rw-r--r-- | pyramid/configuration.py | 24 | ||||
| -rw-r--r-- | pyramid/events.py | 2 | ||||
| -rw-r--r-- | pyramid/interfaces.py | 2 | ||||
| -rw-r--r-- | pyramid/path.py | 4 | ||||
| -rw-r--r-- | pyramid/tests/test_authentication.py | 8 | ||||
| -rw-r--r-- | pyramid/tests/test_configuration.py | 6 | ||||
| -rw-r--r-- | pyramid/tests/test_events.py | 3 | ||||
| -rw-r--r-- | pyramid/tests/test_integration.py | 2 | ||||
| -rw-r--r-- | pyramid/tests/test_path.py | 14 | ||||
| -rw-r--r-- | pyramid/tests/test_zcml.py | 2 | ||||
| -rw-r--r-- | pyramid/view.py | 2 |
13 files changed, 50 insertions, 38 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index a48e3556d..dcfdbcaaa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -87,3 +87,6 @@ Backwards Incompatibilities (with BFG 1.3.X) - The ``bfgshell`` paster command is now named ``pshell``. +- The Venusian "category" for all built-in Venusian decorators + (e.g. ``subscriber`` and ``view_config``/``bfg_view``) is now + ``pyramid`` instead of ``bfg``. @@ -66,8 +66,6 @@ - .flash API on session. -- Signed_signature method of the request and response from pylons2. - - Provide a webob.Response class facade for forward compat. - CRSF token machinery @@ -84,6 +82,16 @@ - Maybe make renderer globals lookup send an event? -- bfgshell - - ``docs`` directory for each paster template. + +- bfg.routes.matchdict and bfg.routes.route + +- repoze.bfg.auth_tkt + +- bfg_locale_name + +- bfg_localizer + +- __bfg_abspath__ + +- "BFG" in environ variables. diff --git a/pyramid/configuration.py b/pyramid/configuration.py index b877441ec..03966c3fd 100644 --- a/pyramid/configuration.py +++ b/pyramid/configuration.py @@ -1576,10 +1576,10 @@ class Configurator(object): :class:`pyramid.view.view_config``. If this is not desirable because the codebase has other Venusian-using decorators that aren't meant to be invoked during a particular scan, use - ``('bfg',)`` as a ``categories`` value to limit the execution + ``('pyramid',)`` as a ``categories`` value to limit the execution of decorator callbacks to only those registered by :mod:`pyramid` itself. Or pass a sequence of Venusian scan - categories as necessary (e.g. ``('bfg', 'myframework')``) to + categories as necessary (e.g. ``('pyramid', 'myframework')``) to limit the decorators called to the set of categories required. """ package = self.maybe_dotted(package) @@ -1917,7 +1917,7 @@ class Configurator(object): The ``name`` argument to ``add_static_view`` is usually a :term:`view name`. When this is the case, the :func:`pyramid.url.static_url` API will generate a URL - which points to a BFG view, which will serve up a set of + which points to a Pyramid view, which will serve up a set of resources that live in the package itself. For example: .. code-block:: python @@ -1935,7 +1935,7 @@ class Configurator(object): that represents a simple view name, as it is above, subsequent calls to :func:`pyramid.url.static_url` with paths that start with the ``path`` argument passed to ``add_static_view`` - will generate a URL something like ``http://<BFG app + will generate a URL something like ``http://<Pyramid app URL>/images/logo.png``, which will cause the ``logo.png`` file in the ``images`` subdirectory of the ``mypackage`` package to be served. @@ -2446,7 +2446,7 @@ def _map_view(view, attr=None, renderer_name=None, registry=None, if requestonly(view, attr): # its __init__ accepts only a single request argument, # instead of both context and request - def _bfg_class_requestonly_view(context, request): + def _class_requestonly_view(context, request): inst = view(request) if attr is None: response = inst() @@ -2459,10 +2459,10 @@ def _map_view(view, attr=None, renderer_name=None, registry=None, response = helper.render_to_response(response, system, request=request) return response - wrapped_view = _bfg_class_requestonly_view + wrapped_view = _class_requestonly_view else: # its __init__ accepts both context and request - def _bfg_class_view(context, request): + def _class_view(context, request): inst = view(context, request) if attr is None: response = inst() @@ -2475,12 +2475,12 @@ def _map_view(view, attr=None, renderer_name=None, registry=None, response = helper.render_to_response(response, system, request=request) return response - wrapped_view = _bfg_class_view + wrapped_view = _class_view elif requestonly(view, attr): # its __call__ accepts only a single request argument, # instead of both context and request - def _bfg_requestonly_view(context, request): + def _requestonly_view(context, request): if attr is None: response = view(request) else: @@ -2493,10 +2493,10 @@ def _map_view(view, attr=None, renderer_name=None, registry=None, response = helper.render_to_response(response, system, request=request) return response - wrapped_view = _bfg_requestonly_view + wrapped_view = _requestonly_view elif attr: - def _bfg_attr_view(context, request): + def _attr_view(context, request): response = getattr(view, attr)(context, request) if helper is not None: if not is_response(response): @@ -2505,7 +2505,7 @@ def _map_view(view, attr=None, renderer_name=None, registry=None, response = helper.render_to_response(response, system, request=request) return response - wrapped_view = _bfg_attr_view + wrapped_view = _attr_view elif helper is not None: def _rendered_view(context, request): diff --git a/pyramid/events.py b/pyramid/events.py index 78acce452..527707fb1 100644 --- a/pyramid/events.py +++ b/pyramid/events.py @@ -66,7 +66,7 @@ class subscriber(object): config.add_subscriber(wrapped, self.ifaces) def __call__(self, wrapped): - self.venusian.attach(wrapped, self.register, category='bfg') + self.venusian.attach(wrapped, self.register, category='pyramid') return wrapped class NewRequest(object): diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py index 56486307a..1c7a8940c 100644 --- a/pyramid/interfaces.py +++ b/pyramid/interfaces.py @@ -244,7 +244,7 @@ class ISettings(Interface): interface.""" # this interface, even if it becomes unused within Pyramid, is -# imported by other packages (such as repoze.bfg.traversalwrapper) +# imported by other packages (such as traversalwrapper) class ILocation(Interface): """Objects that have a structural location""" __parent__ = Attribute("The parent in the location hierarchy") diff --git a/pyramid/path.py b/pyramid/path.py index b5850968f..2b557af5f 100644 --- a/pyramid/path.py +++ b/pyramid/path.py @@ -54,14 +54,14 @@ def caller_package(level=2, caller_module=caller_module): def package_path(package): # computing the abspath is actually kinda expensive so we memoize # the result - prefix = getattr(package, '__bfg_abspath__', None) + prefix = getattr(package, '__abspath__', None) if prefix is None: prefix = pkg_resources.resource_filename(package.__name__, '') # pkg_resources doesn't care whether we feed it a package # name or a module name within the package, the result # will be the same: a directory name to the package itself try: - package.__bfg_abspath__ = prefix + package.__abspath__ = prefix except: # this is only an optimization, ignore any error pass diff --git a/pyramid/tests/test_authentication.py b/pyramid/tests/test_authentication.py index 3bd1587f3..8bae18fba 100644 --- a/pyramid/tests/test_authentication.py +++ b/pyramid/tests/test_authentication.py @@ -460,23 +460,23 @@ class TestAuthTktCookieHelper(unittest.TestCase): def test_remember_path(self): plugin = self._makeOne('secret', include_ip=True, - path="/cgi-bin/bfg.cgi/") + path="/cgi-bin/app.cgi/") request = self._makeRequest() result = plugin.remember(request, 'other') self.assertEqual(len(result), 3) self.assertEqual(result[0][0], 'Set-Cookie') - self.failUnless(result[0][1].endswith('; Path=/cgi-bin/bfg.cgi/')) + self.failUnless(result[0][1].endswith('; Path=/cgi-bin/app.cgi/')) self.failUnless(result[0][1].startswith('auth_tkt=')) self.assertEqual(result[1][0], 'Set-Cookie') self.failUnless(result[1][1].endswith( - '; Path=/cgi-bin/bfg.cgi/; Domain=localhost')) + '; Path=/cgi-bin/app.cgi/; Domain=localhost')) self.failUnless(result[1][1].startswith('auth_tkt=')) self.assertEqual(result[2][0], 'Set-Cookie') self.failUnless(result[2][1].endswith( - '; Path=/cgi-bin/bfg.cgi/; Domain=.localhost')) + '; Path=/cgi-bin/app.cgi/; Domain=.localhost')) self.failUnless(result[2][1].startswith('auth_tkt=')) def test_remember_http_only(self): diff --git a/pyramid/tests/test_configuration.py b/pyramid/tests/test_configuration.py index 2ff6ed1e9..e24876744 100644 --- a/pyramid/tests/test_configuration.py +++ b/pyramid/tests/test_configuration.py @@ -129,9 +129,9 @@ class ConfiguratorTests(unittest.TestCase): def test_ctor_with_package_registry(self): import sys from pyramid.configuration import Configurator - bfg_pkg = sys.modules['pyramid'] - config = Configurator(package=bfg_pkg) - self.assertEqual(config.package, bfg_pkg) + pkg = sys.modules['pyramid'] + config = Configurator(package=pkg) + self.assertEqual(config.package, pkg) def test_ctor_noreg_custom_settings(self): from pyramid.interfaces import ISettings diff --git a/pyramid/tests/test_events.py b/pyramid/tests/test_events.py index 2930683db..7d763b3d6 100644 --- a/pyramid/tests/test_events.py +++ b/pyramid/tests/test_events.py @@ -151,7 +151,8 @@ class TestSubscriber(unittest.TestCase): dec.venusian = dummy_venusian def foo(): pass dec(foo) - self.assertEqual(dummy_venusian.attached, [(foo, dec.register, 'bfg')]) + self.assertEqual(dummy_venusian.attached, + [(foo, dec.register, 'pyramid')]) class DummyConfigurator(object): def __init__(self): diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index 872f50cd4..e8d119e79 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -18,7 +18,7 @@ def wsgiapptest(environ, start_response): """ """ return '123' -class WGSIAppPlusBFGViewTests(unittest.TestCase): +class WGSIAppPlusViewConfigTests(unittest.TestCase): def test_it(self): from venusian import ATTACH_ATTR import types diff --git a/pyramid/tests/test_path.py b/pyramid/tests/test_path.py index 21e7bffe2..c097615af 100644 --- a/pyramid/tests/test_path.py +++ b/pyramid/tests/test_path.py @@ -3,8 +3,8 @@ import unittest class TestCallerPath(unittest.TestCase): def tearDown(self): from pyramid.tests import test_path - if hasattr(test_path, '__bfg_abspath__'): - del test_path.__bfg_abspath__ + if hasattr(test_path, '__abspath__'): + del test_path.__abspath__ def _callFUT(self, path, level=2): from pyramid.path import caller_path @@ -20,10 +20,10 @@ class TestCallerPath(unittest.TestCase): result = self._callFUT('a/b/c') self.assertEqual(result, os.path.join(here, 'a/b/c')) - def test_memoization_has_bfg_abspath(self): + def test_memoization_has_abspath(self): import os from pyramid.tests import test_path - test_path.__bfg_abspath__ = '/foo/bar' + test_path.__abspath__ = '/foo/bar' result = self._callFUT('a/b/c') self.assertEqual(result, os.path.join('/foo/bar', 'a/b/c')) @@ -33,7 +33,7 @@ class TestCallerPath(unittest.TestCase): from pyramid.tests import test_path result = self._callFUT('a/b/c') self.assertEqual(result, os.path.join(here, 'a/b/c')) - self.assertEqual(test_path.__bfg_abspath__, here) + self.assertEqual(test_path.__abspath__, here) class TestCallerModule(unittest.TestCase): def _callFUT(self, level=2): @@ -103,13 +103,13 @@ class TestPackagePath(unittest.TestCase): from pyramid.tests import test_path module = DummyPackageOrModule(test_path) self._callFUT(module) - self.assertEqual(module.__bfg_abspath__, module.package_path) + self.assertEqual(module.__abspath__, module.package_path) def test_memoization_fail(self): from pyramid.tests import test_path module = DummyPackageOrModule(test_path, raise_exc=TypeError) result = self._callFUT(module) - self.failIf(hasattr(module, '__bfg_abspath__')) + self.failIf(hasattr(module, '__abspath__')) self.assertEqual(result, module.package_path) class TestPackageOf(unittest.TestCase): diff --git a/pyramid/tests/test_zcml.py b/pyramid/tests/test_zcml.py index 789188666..b996dff53 100644 --- a/pyramid/tests/test_zcml.py +++ b/pyramid/tests/test_zcml.py @@ -472,7 +472,7 @@ class TestAuthTktAuthenticationPolicyDirective(unittest.TestCase): cookie_name='repoze.bfg.auth_tkt', secure=True, include_ip=True, timeout=100, reissue_time=500, http_only=True, - path="/cgi-bin/bfg.cgi/") + path="/cgi-bin/app.cgi/") class TestACLAuthorizationPolicyDirective(unittest.TestCase): def setUp(self): diff --git a/pyramid/view.py b/pyramid/view.py index bd9d52a24..68a8b92e7 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -408,7 +408,7 @@ class view_config(object): def callback(context, name, ob): context.config.add_view(view=ob, **settings) - info = self.venusian.attach(wrapped, callback, category='bfg') + info = self.venusian.attach(wrapped, callback, category='pyramid') if info.scope == 'class': # if the decorator was attached to a method in a class, or |
