def __init__(self, alias=None, required=False, default=None, default_date=None, validate=None, formats=['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d'], time_formats=['%H:%M:%S', '%H:%M'] ): iter_ = lambda x: x if is_iter(x) else [x,] self.formats = {'datetime': iter_( formats )} if default_date!=None: self.default_date = default_date self.formats['time'] = iter_( time_formats ) if default == None: default = self.__default_date_only else: default = self.__default_with_default_date( default ) Parameter.__init__(self, alias=alias, required=required, default=default, validate=validate)
def __init__(self, description=None, alias=None, aliases=None, required=False, default=None, default_date=None, validate=None, time_formats=['%H:%M:%S', '%H:%M'], formats=['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d']): to_iter = lambda x: x if is_iter(x) else [x,] self.formats = {'datetime': to_iter( formats )} if default_date != None: self.default_date = default_date self.formats['time'] = to_iter( time_formats ) if default == None: default = self.get_default_date_only else: default = self.get_default_with_default_date( default ) super(DateTimeParam, self).__init__( description=description, alias=alias, aliases=aliases, required=required, default=default, validate=validate)