Skip to content
Browse files

squash warnings

  • Loading branch information...
1 parent 0eff160 commit f22d3fa04191e387322eb6c62a5125367e9674ec @mcdonc mcdonc committed Oct 6, 2011
Showing with 12 additions and 7 deletions.
  1. +3 −4 karlserve/application.py
  2. +9 −3 karlserve/tests/test_application.py
View
7 karlserve/application.py
@@ -2,7 +2,7 @@
import os
import time
-from pyramid.configuration import Configurator
+from pyramid.config import Configurator
from pyramid.exceptions import NotFound
from repoze.depinj import lookup
@@ -77,9 +77,8 @@ def make_app(global_config, **local_config):
# Configure repoze.bfg application
config = lookup(Configurator)(settings=settings)
- config.begin()
- config.add_route(name='sites', path='/*subpath', view=site_dispatch)
- config.end()
+ config.add_route('sites', '/*subpath')
+ config.add_view(site_dispatch, route_name='sites')
app = config.make_wsgi_app()
return app
View
12 karlserve/tests/test_application.py
@@ -51,7 +51,9 @@ def test_it(self):
self.assertEqual(settings['who_cookie'], 'terces')
self.assertEqual(settings['blob_cache'], 'var/blob_cache')
self.assertEqual(app._added_routes,
- [('sites', '/*subpath', site_dispatch)])
+ [('sites', '/*subpath')])
+ self.assertEqual(app._added_views,
+ [(site_dispatch, 'sites')])
import os
self.assertEqual(os.environ['TZ'], 'TIMEZONE')
@@ -142,6 +144,7 @@ def __init__(self, settings):
self.settings = settings
self.registry = DummyRegistry(settings)
self._added_routes = []
+ self._added_views = []
settings['bfg.setting'] = 'foo'
def begin(self):
@@ -150,8 +153,11 @@ def begin(self):
def end(self):
pass
- def add_route(self, name, path, view):
- self._added_routes.append((name, path, view))
+ def add_route(self, name, path):
+ self._added_routes.append((name, path))
+
+ def add_view(self, view, route_name):
+ self._added_views.append((view, route_name))
def make_wsgi_app(self):
return self

0 comments on commit f22d3fa

Please sign in to comment.
Something went wrong with that request. Please try again.