This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIMPLE_TYPES = (int, long, float, bool, dict, basestring, list) | |
class BaseModel(db.Model): | |
def to_json_friendly_value(self, v): | |
if v is None or isinstance(v, SIMPLE_TYPES): | |
value = v | |
elif isinstance(v, datetime.date): | |
# Convert date/datetime to ms-since-epoch ("new Date()"). | |
ms = time.mktime(v.utctimetuple()) * 1000 |