Skip to content

Instantly share code, notes, and snippets.

klenwell klenwell

Block or report user

Report or block klenwell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chrisfarms
chrisfarms / basemodel.py
Created Mar 22, 2011
GAE base model class with to_json serialisation
View basemodel.py
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
You can’t perform that action at this time.