diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-09-23 02:32:34 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-09-23 02:32:34 +0000 |
| commit | 69626ce4531664532870c950f4c1d66a0830a50a (patch) | |
| tree | 877f21737c0d33e9b15597e6e64691075f950cd7 | |
| parent | 567709808add935811925f94e3804e08f66888a4 (diff) | |
| download | pyramid-69626ce4531664532870c950f4c1d66a0830a50a.tar.gz pyramid-69626ce4531664532870c950f4c1d66a0830a50a.tar.bz2 pyramid-69626ce4531664532870c950f4c1d66a0830a50a.zip | |
- On 64-bit Linux systems, views that were members of a multiview
(orderings of views with predicates) were not evaluated in the
proper order. Symptom: in a configuration that had two views with
the same name but one with a ``request_method=POST`` predicate and
one without, the one without the predicate would be called
unconditionally (even if the request was a POST request). Thanks
much to Sebastien Douche for providing the buildbots that pointed
this out.
| -rw-r--r-- | CHANGES.txt | 12 | ||||
| -rw-r--r-- | repoze/bfg/zcml.py | 8 |
2 files changed, 15 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index e6b44519c..ed4dd29ff 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,18 @@ Next release ============ +Bug Fixes +--------- + +- On 64-bit Linux systems, views that were members of a multiview + (orderings of views with predicates) were not evaluated in the + proper order. Symptom: in a configuration that had two views with + the same name but one with a ``request_method=POST`` predicate and + one without, the one without the predicate would be called + unconditionally (even if the request was a POST request). Thanks + much to Sebastien Douche for providing the buildbots that pointed + this out. + Documentation ------------- diff --git a/repoze/bfg/zcml.py b/repoze/bfg/zcml.py index 72b39fcb3..3faadb24b 100644 --- a/repoze/bfg/zcml.py +++ b/repoze/bfg/zcml.py @@ -194,7 +194,7 @@ def view( # 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. + # sys.maxint, meaning that they will be tried very last. if request_method is not None: def request_method_predicate(context, request): @@ -219,10 +219,8 @@ def view( weight = weight - 30 predicates.append(containment_predicate) - if predicates: - score = float(weight) / len(predicates) - else: - score = sys.maxint + # this will be == sys.maxint if no predicates + score = weight / (len(predicates) + 1) if renderer and '.' in renderer: renderer = resource_spec(renderer, package_name(_context.resolve('.'))) |
