OpenQuizz
Une application de gestion des contenus pédagogiques
Argument Class Reference
Inheritance diagram for Argument:
Collaboration diagram for Argument:

Public Member Functions

def __init__ (self, name, default=None, dest=None, required=False, ignore=False, type=text_type, location=('json', 'values',), choices=(), action='store', help=None, operators=('=',), case_sensitive=True, store_missing=True, trim=False, nullable=True)
 
def __str__ (self)
 
def __repr__ (self)
 
def source (self, request)
 
def convert (self, value, op)
 
def handle_validation_error (self, error, bundle_errors)
 
def parse (self, request, bundle_errors=False)
 

Data Fields

 name
 
 default
 
 dest
 
 required
 
 ignore
 
 location
 
 type
 
 choices
 
 action
 
 help
 
 case_sensitive
 
 operators
 
 store_missing
 
 trim
 
 nullable
 

Detailed Description

:param name: Either a name or a list of option strings, e.g. foo or
    -f, --foo.
:param default: The value produced if the argument is absent from the
    request.
:param dest: The name of the attribute to be added to the object
    returned by :meth:`~reqparse.RequestParser.parse_args()`.
:param bool required: Whether or not the argument may be omitted (optionals
    only).
:param action: The basic type of action to be taken when this argument
    is encountered in the request. Valid options are "store" and "append".
:param ignore: Whether to ignore cases where the argument fails type
    conversion
:param type: The type to which the request argument should be
    converted. If a type raises an exception, the message in the
    error will be returned in the response. Defaults to :class:`unicode`
    in python2 and :class:`str` in python3.
:param location: The attributes of the :class:`flask.Request` object
    to source the arguments from (ex: headers, args, etc.), can be an
    iterator. The last item listed takes precedence in the result set.
:param choices: A container of the allowable values for the argument.
:param help: A brief description of the argument, returned in the
    response when the argument is invalid. May optionally contain
    an "{error_msg}" interpolation token, which will be replaced with
    the text of the error raised by the type converter.
:param bool case_sensitive: Whether argument values in the request are
    case sensitive or not (this will convert all values to lowercase)
:param bool store_missing: Whether the arguments default value should
    be stored if the argument is missing from the request.
:param bool trim: If enabled, trims whitespace around the argument.
:param bool nullable: If enabled, allows null value in argument.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  default = None,
  dest = None,
  required = False,
  ignore = False,
  type = text_type,
  location = ('json', 'values',),
  choices = (),
  action = 'store',
  help = None,
  operators = ('=',),
  case_sensitive = True,
  store_missing = True,
  trim = False,
  nullable = True 
)

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

◆ __str__()

def __str__ (   self)

◆ convert()

def convert (   self,
  value,
  op 
)

◆ handle_validation_error()

def handle_validation_error (   self,
  error,
  bundle_errors 
)
Called when an error is raised while parsing. Aborts the request
with a 400 status and an error message

:param error: the error that was raised
:param bundle_errors: do not abort when first error occurs, return a
    dict with the name of the argument and the error message to be
    bundled

◆ parse()

def parse (   self,
  request,
  bundle_errors = False 
)
Parses argument value(s) from the request, converting according to
the argument's type.

:param request: The flask request object to parse arguments from
:param bundle_errors: Do not abort when first error occurs, return a
    dict with the name of the argument and the error message to be
    bundled

◆ source()

def source (   self,
  request 
)
Pulls values off the request in the provided location
:param request: The flask request object to parse arguments from

Field Documentation

◆ action

action

◆ case_sensitive

case_sensitive

◆ choices

choices

◆ default

default

◆ dest

dest

◆ help

help

◆ ignore

ignore

◆ location

location

◆ name

name

◆ nullable

nullable

◆ operators

operators

◆ required

required

◆ store_missing

store_missing

◆ trim

trim

◆ type

type

The documentation for this class was generated from the following file: