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

Public Member Functions

def __init__ (self, formats=None)
 
def get_metavar (self, param)
 
def convert (self, value, param, ctx)
 
def __repr__ (self)
 
- Public Member Functions inherited from ParamType
def __call__ (self, value, param=None, ctx=None)
 
def get_missing_message (self, param)
 
def split_envvar_value (self, rv)
 
def fail (self, message, param=None, ctx=None)
 

Data Fields

 formats
 

Static Public Attributes

string name = "datetime"
 
- Static Public Attributes inherited from ParamType
bool is_composite = False
 
 name = None
 
 envvar_list_splitter = None
 

Detailed Description

The DateTime type converts date strings into `datetime` objects.

The format strings which are checked are configurable, but default to some
common (non-timezone aware) ISO 8601 formats.

When specifying *DateTime* formats, you should only pass a list or a tuple.
Other iterables, like generators, may lead to surprising results.

The format strings are processed using ``datetime.strptime``, and this
consequently defines the format strings which are allowed.

Parsing is tried using each format, in order, and the first format which
parses successfully is used.

:param formats: A list or tuple of date format strings, in the order in
                which they should be tried. Defaults to
                ``'%Y-%m-%d'``, ``'%Y-%m-%dT%H:%M:%S'``,
                ``'%Y-%m-%d %H:%M:%S'``.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  formats = None 
)

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

◆ convert()

def convert (   self,
  value,
  param,
  ctx 
)
Converts the value.  This is not invoked for values that are
`None` (the missing value).

Reimplemented from ParamType.

◆ get_metavar()

def get_metavar (   self,
  param 
)
Returns the metavar default for this param if it provides one.

Reimplemented from ParamType.

Field Documentation

◆ formats

formats

◆ name

string name = "datetime"
static

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