diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-01-21 01:12:14 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-01-21 01:12:14 +0000 |
| commit | 1a74dc000993f39a430b6c37d775bb664e86a3ac (patch) | |
| tree | 7651f1848d04b0f686e32c087aea4e86511b5dc0 | |
| parent | 74a8f69ebc691c0850ab72d8bca421e7b4de52a5 (diff) | |
| download | pyramid-1a74dc000993f39a430b6c37d775bb664e86a3ac.tar.gz pyramid-1a74dc000993f39a430b6c37d775bb664e86a3ac.tar.bz2 pyramid-1a74dc000993f39a430b6c37d775bb664e86a3ac.zip | |
Disuse sys.maxint; that's silly. Use a hardcoded MAX_WEIGHT value.
| -rw-r--r-- | repoze/bfg/configuration.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py index 08fc0da0a..4f3837058 100644 --- a/repoze/bfg/configuration.py +++ b/repoze/bfg/configuration.py @@ -60,6 +60,8 @@ from repoze.bfg.urldispatch import RoutesMapper from repoze.bfg.view import render_view_to_response from repoze.bfg.view import static +MAX_WEIGHT = 10000 + DEFAULT_RENDERERS = ( ('.pt', chameleon_zpt.renderer_factory), ('.txt', chameleon_text.renderer_factory), @@ -406,7 +408,6 @@ class Configurator(object): the current configuration state and sends a :class:`repoze.bfg.interfaces.IWSGIApplicationCreatedEvent` event to all listeners.""" - # manager in arglist for testing dep injection only from repoze.bfg.router import Router # avoid circdep app = Router(self.registry) # We push the registry on to the stack here in case any code @@ -779,7 +780,7 @@ class Configurator(object): else: multiview = MultiView(name) old_accept = getattr(old_view, '__accept__', None) - multiview.add(old_view, sys.maxint, old_accept) + multiview.add(old_view, MAX_WEIGHT, old_accept) multiview.add(derived_view, score, accept) for view_type in (IView, ISecuredView): # unregister any existing views @@ -1190,7 +1191,6 @@ class Configurator(object): See :ref:`changing_the_forbidden_view` for more information.""" - return self._system_view(IForbiddenView, *arg, **kw) def set_notfound_view(self, *arg, **kw): @@ -1373,14 +1373,14 @@ def _make_predicates(xhr=None, request_method=None, path_info=None, # share the same number of predicates. # Views which do not have any predicates get a score of - # sys.maxint, meaning that they will be tried very last. + # MAX_WEIGHT, meaning that they will be tried very last. predicates = [] - weight = sys.maxint + weight = MAX_WEIGHT if custom: for predicate in custom: - weight = weight - 1 + weight = weight - 10 predicates.append(predicate) if xhr: @@ -1445,7 +1445,7 @@ def _make_predicates(xhr=None, request_method=None, path_info=None, weight = weight - 80 predicates.append(containment_predicate) - # this will be == sys.maxint if no predicates + # this will be == MAX_WEIGHT if no predicates score = weight / (len(predicates) + 1) return score, predicates @@ -1792,7 +1792,7 @@ def _accept_wrap(view, accept): return accept_view # note that ``options`` is a b/w compat alias for ``settings`` and -# ``Configurator`` and ``getSiteManager`` are testing dep injs +# ``Configurator`` is a testing dep inj def make_app(root_factory, package=None, filename='configure.zcml', settings=None, options=None, Configurator=Configurator): """ Return a Router object, representing a fully configured |
