Package gavo :: Package protocols :: Module uwsactions :: Class DestructionAction
[frames] | no frames]

Class DestructionAction

source code

 object --+        
          |        
  JobAction --+    
              |    
_SettableAction --+
                  |
                 DestructionAction

Instance Methods

Inherited from _SettableAction: doGET, doPOST

Inherited from JobAction: getResource

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
serializeValue(dt)
returns some ISO8601 representation of a datetime instance.
source code
 
deserializeValue(literal)
returns a datetime object for a ISO time literal.
source code
Class Variables
  name = 'destruction'
hash(x)
  attName = 'destructionTime'

Inherited from _SettableAction: mime

Properties

Inherited from object: __class__

Method Details

serializeValue(dt)
Static Method

source code 

returns some ISO8601 representation of a datetime instance.

The reason for preferring this function over a simple str is that datetime's default representation is too difficult for some other code (e.g., itself); hence, this code suppresses any microsecond part and always adds a Z (where strftime works, utils.isoTimestampFmt produces an identical string).

The behaviour of this function for timezone-aware datetimes is undefined.

For convenience, None is returned as None

>>> formatISODT(datetime.datetime(2015, 10, 20, 12, 34, 22, 250))
'2015-10-20T12:34:22Z'
>>> formatISODT(datetime.datetime(1815, 10, 20, 12, 34, 22, 250))
'1815-10-20T12:34:22Z'
>>> formatISODT(datetime.datetime(2018, 9, 21, 23, 59, 59, 640000))
'2018-09-22T00:00:00Z'

deserializeValue(literal)
Static Method

source code 

returns a datetime object for a ISO time literal.

There's no real timezone support yet, but we accept and ignore various ways of specifying UTC.

>>> parseISODT("1998-12-14")
datetime.datetime(1998, 12, 14, 0, 0)
>>> parseISODT("1998-12-14T13:30:12")
datetime.datetime(1998, 12, 14, 13, 30, 12)
>>> parseISODT("1998-12-14T13:30:12Z")
datetime.datetime(1998, 12, 14, 13, 30, 12)
>>> parseISODT("1998-12-14T13:30:12.224Z")
datetime.datetime(1998, 12, 14, 13, 30, 12, 224000)
>>> parseISODT("19981214T133012Z")
datetime.datetime(1998, 12, 14, 13, 30, 12)
>>> parseISODT("19981214T133012+00:00")
datetime.datetime(1998, 12, 14, 13, 30, 12)
>>> parseISODT("junk")
Traceback (most recent call last):
ValueError: Bad ISO datetime literal: junk (required format: yyyy-mm-ddThh:mm:ssZ)