Mercurial > hg > decoupage
view decoupage/formats.py @ 59:07cf168aa98c
make formats classes that can take arguments
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sun, 21 Nov 2010 13:23:34 -0800 |
parents | 1275124ed767 |
children | cf18ea0313f9 |
line wrap: on
line source
""" pluggable formats for directory listings """ try: import json as json except ImportError: import simplejson as json class JSON(object): """ JSON format for index pages just (basically) return the data """ def __init__(self, app, foo): self.app = app def __call__(self, request, data): # fix datetime for f in data['files']: if 'modified' in f: f['modified'] = f['modified'].ctime() return 'application/json', json.dumps(data['files']) class RSS(object): """RSS for indices""" def __init__(self, app, count=10, cascade=False): self.app = app # the decoupage self.count = int(count) self.cascade = cascade def __call__(self, request, data): import pdb; pdb.set_trace()