Ejemplo n.º 1
0
def validate_file(argname, param, safe, hashkey, optional=False):
    """Validates that an argument is a file and matches the hashkey.

    Checks that an argument named `argname` exists in `param.kwargs`
    and it is a tar file which matches the provided hashkey. If
    successful the string is copied into `safe.kwargs` and the value
    is removed from `param.kwargs`.

    If `optional` is True, the argument is not required to exist in
    `param.kwargs`; None is then inserted into `safe.kwargs`. Otherwise
    a missing value raises an exception."""
    _validate_one(argname, param, safe, _check_file, optional)
Ejemplo n.º 2
0
def validate_file(argname, param, safe, hashkey, optional=False):
    """Validates that an argument is a file and matches the hashkey.

    Checks that an argument named `argname` exists in `param.kwargs`
    and it is a tar file which matches the provided hashkey. If
    successful the string is copied into `safe.kwargs` and the value
    is removed from `param.kwargs`.

    If `optional` is True, the argument is not required to exist in
    `param.kwargs`; None is then inserted into `safe.kwargs`. Otherwise
    a missing value raises an exception."""
    _validate_one(argname, param, safe, _check_file, optional)
Ejemplo n.º 3
0
def validate_ip(argname, param, safe, optional=False):
    """Validates that an argument is a valid IP address.

  Checks that an argument named `argname` exists in `param.kwargs`
  and it is a string convertible to an `IPAddress` object. If
  successful the string is copied into `safe.kwargs` and the value
  is removed from `param.kwargs`.

  If `optional` is True, the argument is not required to exist in
  `param.kwargs`; None is then inserted into `safe.kwargs`. Otherwise
  a missing value raises an exception."""
    _validate_one(argname, param, safe, _check_ip, optional)
Ejemplo n.º 4
0
def validate_ip(argname, param, safe, optional = False):
  """Validates that an argument is a valid IP address.

  Checks that an argument named `argname` exists in `param.kwargs`
  and it is a string convertible to an `IPAddress` object. If
  successful the string is copied into `safe.kwargs` and the value
  is removed from `param.kwargs`.

  If `optional` is True, the argument is not required to exist in
  `param.kwargs`; None is then inserted into `safe.kwargs`. Otherwise
  a missing value raises an exception."""
  _validate_one(argname, param, safe, _check_ip, optional)