Package s3 :: Module s3validators :: Class IS_UTC_DATE
[frames] | no frames]

Class IS_UTC_DATE

source code

gluon.validators.Validator --+    
                             |    
               IS_UTC_DATETIME --+
                                 |
                                IS_UTC_DATE

Validates a given date and returns the corresponding datetime.date object in UTC. Accepted input types are strings (in local format), datetime.datetime and datetime.date.

Example:


Note: dates stretch 8 hours West and 16 hours East of the current time zone, i.e. the most Eastern timezones are on the next day.

Instance Methods
 
__init__(self, format=None, error_message=None, offset_error=None, calendar=None, utc_offset=None, minimum=None, maximum=None)
Constructor
source code
 
__call__(self, value)
Validate a value, and convert it into a datetime.date object as necessary
source code
 
formatter(self, value)
Format a date as string.
source code

Inherited from IS_UTC_DATETIME: delta

Method Details

__init__(self, format=None, error_message=None, offset_error=None, calendar=None, utc_offset=None, minimum=None, maximum=None)
(Constructor)

source code 

Constructor

Parameters:
  • format - strptime/strftime format template string, for directives refer to your strptime implementation
  • error_message - error message for invalid date/times
  • offset_error - error message for invalid UTC offset
  • calendar - calendar to use for string evaluation, defaults to current.calendar
  • utc_offset - offset to UTC in seconds, defaults to the current session's UTC offset
  • minimum - the minimum acceptable date (datetime.date)
  • maximum - the maximum acceptable date (datetime.date)
Overrides: IS_UTC_DATETIME.__init__

__call__(self, value)
(Call operator)

source code 

Validate a value, and convert it into a datetime.date object as necessary

Parameters:
  • value - the value to validate
Returns:
tuple (value, error)
Overrides: IS_UTC_DATETIME.__call__

formatter(self, value)

source code 

Format a date as string.

Parameters:
  • value - the value
Overrides: IS_UTC_DATETIME.formatter