Michael Merickel
2012-10-14 4b8cf2d4e9711189e800dcb470a29773e4269f92
updated request_param and match_param to use as_sorted_tuple
1 files modified
10 ■■■■■ changed files
pyramid/config/predicates.py 10 ●●●●● patch | view | raw | blame | history
pyramid/config/predicates.py
@@ -64,10 +64,7 @@
    
class RequestParamPredicate(object):
    def __init__(self, val, config):
        if not is_nonstr_iter(val):
            val = (val,)
        val = sorted(val)
        self.val = val
        val = as_sorted_tuple(val)
        reqs = []
        for p in val:
            k = p
@@ -76,6 +73,7 @@
                k, v = p.split('=', 1)
                k, v = k.strip(), v.strip()
            reqs.append((k, v))
        self.val = val
        self.reqs = reqs
    def text(self):
@@ -163,9 +161,7 @@
    
class MatchParamPredicate(object):
    def __init__(self, val, config):
        if not is_nonstr_iter(val):
            val = (val,)
        val = sorted(val)
        val = as_sorted_tuple(val)
        self.val = val
        reqs = [ p.split('=', 1) for p in val ]
        self.reqs = [ (x.strip(), y.strip()) for x, y in reqs ]