predicates.py
branchstable
changeset 9013 b4bcabf55e77
parent 8889 be91151107f6
child 9157 3e4bef7d514d
equal deleted inserted replaced
9012:2cf127d4f5fd 9013:b4bcabf55e77
  1487 
  1487 
  1488     def _values_set(self, cls, req, **kwargs):
  1488     def _values_set(self, cls, req, **kwargs):
  1489         return frozenset(req.form)
  1489         return frozenset(req.form)
  1490 
  1490 
  1491 
  1491 
       
  1492 class match_http_method(ExpectedValuePredicate):
       
  1493     """Return non-zero score if one of the HTTP methods specified as
       
  1494     initializer arguments is the HTTP method of the request (GET, POST, ...).
       
  1495     """
       
  1496 
       
  1497     def __call__(self, cls, req, **kwargs):
       
  1498         return int(req.http_method() in self.expected)
       
  1499 
       
  1500 
  1492 class match_edited_type(ExpectedValuePredicate):
  1501 class match_edited_type(ExpectedValuePredicate):
  1493     """return non-zero if main edited entity type is the one specified as
  1502     """return non-zero if main edited entity type is the one specified as
  1494     initializer argument, or is among initializer arguments if `mode` == 'any'.
  1503     initializer argument, or is among initializer arguments if `mode` == 'any'.
  1495     """
  1504     """
  1496 
  1505