Python pytz.tzinfo.DstTzInfo() Examples
The following are 1
code examples of pytz.tzinfo.DstTzInfo().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pytz.tzinfo
, or try the search function
.
Example #1
Source File: fields.py From zou with GNU Affero General Public License v3.0 | 5 votes |
def serialize_value(value): """ Utility function to handle the normalizing of specific fields. The aim is to make the result JSON serializable """ if isinstance(value, datetime.datetime): return value.replace(microsecond=0).isoformat() if isinstance(value, datetime.date): return value.isoformat() elif isinstance(value, uuid.UUID): return str(value) elif isinstance(value, dict): return serialize_dict(value) elif isinstance(value, orm.collections.InstrumentedList): return serialize_orm_arrays(value) elif isinstance(value, bytes): return value.decode("utf-8") elif isinstance(value, str): return value elif isinstance(value, int): return value elif isinstance(value, list): return serialize_list(value) elif isinstance(value, Locale): return str(value) elif isinstance(value, tzinfo.DstTzInfo): return str(value) elif isinstance(value, Choice): return value.code elif isinstance(value, IPv4Address): return str(value) elif value is None: return None elif isinstance(value, object): if hasattr(value, "serialize"): return value.serialize() else: return value else: return value