# HG changeset patch # User souliane # Date 1393172525 -3600 # Node ID d7870ab9d1ff2e50bb2736fd3f4d02da02b8901b # Parent 30d03d9f07e4ffea712e460994e3da54b556f653 server_side: blog: bug fixes diff -r 30d03d9f07e4 -r d7870ab9d1ff libervia_server/blog.py --- a/libervia_server/blog.py Sun Feb 23 17:01:03 2014 +0100 +++ b/libervia_server/blog.py Sun Feb 23 17:22:05 2014 +0100 @@ -86,11 +86,19 @@
%(user)s
""" % {'user': user}) - mblog_data = sorted(mblog_data, key=lambda entry: (-int(entry.get('published', 0)))) + mblog_data = sorted(mblog_data, key=lambda entry: (-float(entry.get('published', 0)))) for entry in mblog_data: timestamp = float(entry.get('published', 0)) _datetime = datetime.fromtimestamp(timestamp) - getText = lambda key: entry['%s_xhtml' % key].encode() if ('%s_xhtml' % key) in entry else (addURLToText(sanitizeHtml(entry[key])).encode('utf-8') if key in entry else '') + + def getText(key): + if ('%s_xhtml' % key) in entry: + return entry['%s_xhtml' % key].encode('utf-8') + elif key in entry: + processor = addURLToText if key.startswith('content') else sanitizeHtml + return processor(entry[key]).encode('utf-8') + return '' + body = getText('content') title = getText('title') if title: