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
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
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
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
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