view decoupage/formats.py @ 49:ac693b8df32c

add idea of formats and json format
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 03 Nov 2010 08:18:50 -0700
parents
children a2f09d749a3f 0e2b9e0507c5
line wrap: on
line source

try:
  import json as json
except ImportError:
  import simplejson as json

def format_json(data):

  # fix datetime
  for f in data['files']:
    f['modified'] = f['modified'].ctime()

  return 'application/json', json.dumps(data['files'])