From 790c71521786cadeba729b062997f91b5f46e8a2 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 24 Sep 2011 00:21:59 -0400 Subject: fix tests on py2 --- pyramid/config/util.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyramid/config/util.py b/pyramid/config/util.py index 0b3d14f07..febef4b8f 100644 --- a/pyramid/config/util.py +++ b/pyramid/config/util.py @@ -3,6 +3,7 @@ import traceback from pyramid.compat import string_types from pyramid.compat import bytes_ +from pyramid.compat import is_nonstr_iter from pyramid.exceptions import ConfigurationError from pyramid.traversal import find_interface from pyramid.traversal import traversal_path @@ -180,7 +181,7 @@ def make_predicates(xhr=None, request_method=None, path_info=None, containment_predicate.__text__ = "containment = %s" % containment weights.append(1 << 7) predicates.append(containment_predicate) - h.update(bytes_('containment:%r' % containment)) + h.update(bytes_('containment:%r' % hash(containment))) if request_type is not None: def request_type_predicate(context, request): @@ -189,7 +190,7 @@ def make_predicates(xhr=None, request_method=None, path_info=None, request_type_predicate.__text__ = text % request_type weights.append(1 << 8) predicates.append(request_type_predicate) - h.update(bytes_('request_type:%r' % request_type)) + h.update(bytes_('request_type:%r' % hash(request_type))) if match_param is not None: if isinstance(match_param, string_types): @@ -225,7 +226,7 @@ def make_predicates(xhr=None, request_method=None, path_info=None, # functions for custom predicates, so that the hash output # of predicate instances which are "logically the same" # may compare equal. - h.update(bytes_('custom%s:%r' % (num, predicate))) + h.update(bytes_('custom%s:%r' % (num, hash(predicate)))) weights.append(1 << 10) if traverse is not None: @@ -257,7 +258,7 @@ def make_predicates(xhr=None, request_method=None, path_info=None, return order, predicates, phash def as_sorted_tuple(val): - if not hasattr(val, '__iter__'): + if not is_nonstr_iter(val): val = (val,) val = tuple(sorted(val)) return val -- cgit v1.2.3