Exemplo n.º 1
0
    def __init__(self, *nested_rules):
        """Constructs a new Rule for validating requests. Any
        nested rules needed for validating parts of the request
        (such as headers, query string params, etc) should
        also be passed in.

        :param nested_rules: Any sub rules that also should be
          used for validation
        """
        # If we get something that's not a request here,
        # something bad happened in the server (i.e.
        # maybe a programming error), so return a 500

        # NOTE(TheSriram): One should not be creating a generic empty
        # RequestRule, a list of rules always needs to be passed in as
        # arguments.
        # Example: RequestRule(OffsetMarkerRule, LimitRule)
        Rule.__init__(self,
                      vfunc=is_request(none_ok=True),  # pragma: no cover
                      errfunc=lambda: _abort(500),
                      nested_rules=list(nested_rules))
Exemplo n.º 2
0
    def __init__(self, *nested_rules):
        """Constructs a new Rule for validating requests. Any
        nested rules needed for validating parts of the request
        (such as headers, query string params, etc) should
        also be passed in.

        :param nested_rules: Any sub rules that also should be
          used for validation
        """
        # If we get something that's not a request here,
        # something bad happened in the server (i.e.
        # maybe a programming error), so return a 500

        # NOTE(TheSriram): One should not be creating a generic empty
        # RequestRule, a list of rules always needs to be passed in as
        # arguments.
        # Example: RequestRule(OffsetMarkerRule, LimitRule)
        Rule.__init__(
            self,
            vfunc=is_request(none_ok=True),  # pragma: no cover
            errfunc=lambda: _abort(500),
            nested_rules=list(nested_rules))
Exemplo n.º 3
0
 def __init__(self, querystring_name, vfunc, errfunc):
     getter = lambda req: req.get_param(querystring_name)
     Rule.__init__(self, vfunc=vfunc, getter=getter, errfunc=errfunc)
Exemplo n.º 4
0
 def __init__(self, querystring_name, vfunc, errfunc):
     getter = lambda req: req.get_param(querystring_name)
     Rule.__init__(self, vfunc=vfunc, getter=getter, errfunc=errfunc)