# HG changeset patch # User Jeff Hammel # Date 1344120952 25200 # Node ID 262fb90a54b4c27a1e9916fccfee04fe992661bd # Parent 9fac583485203c485518f595efde8f608a23623b make template loading lenient and other fixes; bump version diff -r 9fac58348520 -r 262fb90a54b4 decoupage/formats.py --- a/decoupage/formats.py Fri Aug 03 23:48:25 2012 -0700 +++ b/decoupage/formats.py Sat Aug 04 15:55:52 2012 -0700 @@ -27,7 +27,7 @@ f['modified'] = f['modified'].ctime() return 'application/json', json.dumps(data['files']) - + class RSS(object): """RSS for indices""" @@ -38,7 +38,7 @@ def __call__(self, request, data): items = [ PyRSS2Gen.RSSItem(title=item['name'], - description=item['description'] or item['name'], + description=item['description'] or item.get('title') or item['name'], pubDate=item['modified'], guid=PyRSS2Gen.Guid(link(request, item['path']))) for item in data['files'] ] diff -r 9fac58348520 -r 262fb90a54b4 decoupage/formatters.py --- a/decoupage/formatters.py Fri Aug 03 23:48:25 2012 -0700 +++ b/decoupage/formatters.py Sat Aug 04 15:55:52 2012 -0700 @@ -17,6 +17,7 @@ defaults = {} # default values for attrs to be set on the instance def __init__(self, string): + self._string = string args = [ i.strip() for i in string.split(',')] for index, arg in enumerate(args): if '=' in arg: @@ -174,6 +175,18 @@ defaults = { 'separator': ':' } def __call__(self, request, data): + + # title webpage + title = self._string + if ':' in title: + _title, url = [i.strip() for i in title.split(':', 1)] + if '://' in url: + # XXX could also use urlparse + title = _title + data['link'] = url + data['title'] = title + + # title files for f in data['files']: if f['description'] and self.separator in f['description']: title, description = f['description'].split(self.separator, 1) diff -r 9fac58348520 -r 262fb90a54b4 decoupage/templates/index.html --- a/decoupage/templates/index.html Fri Aug 03 23:48:25 2012 -0700 +++ b/decoupage/templates/index.html Sat Aug 04 15:55:52 2012 -0700 @@ -10,7 +10,7 @@ -

${title}

+

${title}${title}