示例#1
0
文件: routes.py 项目: esehara/pyramid
 def route_predlist(self):
     predlist = self.registry.queryUtility(IPredicateList, name='route')
     if predlist is None:
         predlist = PredicateList()
         self.registry.registerUtility(predlist,
                                       IPredicateList,
                                       name='route')
     return predlist
示例#2
0
 def _makeOne(self):
     from pyramid.config.util import PredicateList
     from pyramid import predicates
     inst = PredicateList()
     for name, factory in (
         ('xhr', predicates.XHRPredicate),
         ('request_method', predicates.RequestMethodPredicate),
         ('path_info', predicates.PathInfoPredicate),
         ('request_param', predicates.RequestParamPredicate),
         ('header', predicates.HeaderPredicate),
         ('accept', predicates.AcceptPredicate),
         ('containment', predicates.ContainmentPredicate),
         ('request_type', predicates.RequestTypePredicate),
         ('match_param', predicates.MatchParamPredicate),
         ('custom', predicates.CustomPredicate),
         ('traverse', predicates.TraversePredicate),
     ):
         inst.add(name, factory)
     return inst
示例#3
0
 def _makeOne(self):
     from pyramid.config.util import PredicateList
     from pyramid.config import predicates
     inst = PredicateList()
     for name, factory in (
         ('xhr', predicates.XHRPredicate),
         ('request_method', predicates.RequestMethodPredicate),
         ('path_info', predicates.PathInfoPredicate),
         ('request_param', predicates.RequestParamPredicate),
         ('header', predicates.HeaderPredicate),
         ('accept', predicates.AcceptPredicate),
         ('containment', predicates.ContainmentPredicate),
         ('request_type', predicates.RequestTypePredicate),
         ('match_param', predicates.MatchParamPredicate),
         ('custom', predicates.CustomPredicate),
         ('traverse', predicates.TraversePredicate),
         ):
         inst.add(name, factory)
     return inst
示例#4
0
    def _makeOne(self):
        from pyramid.config.util import PredicateList
        from pyramid import predicates

        inst = PredicateList()
        for name, factory in (
            ("xhr", predicates.XHRPredicate),
            ("request_method", predicates.RequestMethodPredicate),
            ("path_info", predicates.PathInfoPredicate),
            ("request_param", predicates.RequestParamPredicate),
            ("header", predicates.HeaderPredicate),
            ("accept", predicates.AcceptPredicate),
            ("containment", predicates.ContainmentPredicate),
            ("request_type", predicates.RequestTypePredicate),
            ("match_param", predicates.MatchParamPredicate),
            ("custom", predicates.CustomPredicate),
            ("traverse", predicates.TraversePredicate),
        ):
            inst.add(name, factory)
        return inst
示例#5
0
 def get_predlist(self, name):
     predlist = self.registry.queryUtility(IPredicateList, name=name)
     if predlist is None:
         predlist = PredicateList()
         self.registry.registerUtility(predlist, IPredicateList, name=name)
     return predlist