comparison decoupage/formats.py @ 70:262fb90a54b4

make template loading lenient and other fixes; bump version
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 04 Aug 2012 15:55:52 -0700
parents cf18ea0313f9
children 94298e137131
comparison
equal deleted inserted replaced
69:9fac58348520 70:262fb90a54b4
25 for f in data['files']: 25 for f in data['files']:
26 if 'modified' in f: 26 if 'modified' in f:
27 f['modified'] = f['modified'].ctime() 27 f['modified'] = f['modified'].ctime()
28 28
29 return 'application/json', json.dumps(data['files']) 29 return 'application/json', json.dumps(data['files'])
30 30
31 class RSS(object): 31 class RSS(object):
32 """RSS for indices""" 32 """RSS for indices"""
33 33
34 def __init__(self, app, count=10, cascade=False): 34 def __init__(self, app, count=10, cascade=False):
35 self.app = app # the decoupage 35 self.app = app # the decoupage
36 self.count = int(count) 36 self.count = int(count)
37 self.cascade = cascade 37 self.cascade = cascade
38 38
39 def __call__(self, request, data): 39 def __call__(self, request, data):
40 items = [ PyRSS2Gen.RSSItem(title=item['name'], 40 items = [ PyRSS2Gen.RSSItem(title=item['name'],
41 description=item['description'] or item['name'], 41 description=item['description'] or item.get('title') or item['name'],
42 pubDate=item['modified'], 42 pubDate=item['modified'],
43 guid=PyRSS2Gen.Guid(link(request, item['path']))) 43 guid=PyRSS2Gen.Guid(link(request, item['path'])))
44 for item in data['files'] ] 44 for item in data['files'] ]
45 path_link = link(request, data['path']) 45 path_link = link(request, data['path'])
46 rss = PyRSS2Gen.RSS2(title=data['title'] or data['path'], 46 rss = PyRSS2Gen.RSS2(title=data['title'] or data['path'],