Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

better <title> for quote pages

  • Loading branch information...
commit 5d70c792016a4a2200b481d23e4736f11388a02b 1 parent d26eaef
@fabricio2345 fabricio2345 authored
Showing with 11 additions and 3 deletions.
  1. +7 −2 customfilters.py
  2. +3 −0  main.py
  3. +1 −1  templates/show.html
View
9 customfilters.py
@@ -7,7 +7,12 @@
def twitter_at_linkify(s):
p = re.compile('(@)([\w]+)', re.MULTILINE)
return p.sub(r'<a href="http://twitter.com/\2" >\1\2</a>',s)
-
register.filter(twitter_at_linkify)
-
+# converts a list to a comma separated string with 'and' as the last separator
+def inline_list(l, sort=True, separator=', ', last_separator=' and '):
+ if(sort): l.sort()
+ list_size = len(l)
+ return separator.join(l[:list_size-1]) + (last_separator if list_size > 1 else '') +l[list_size-1]
+register.filter(inline_list)
+
View
3  main.py
@@ -285,13 +285,16 @@ def get(self, short, rubish):
return False
just_created = ((datetime.datetime.now() - dialogue.created_date).seconds < 5)
tweets = simplejson.loads(dialogue.json)
+ authors = {}
for tweet in tweets:
tweet['created_at'] = datetime.datetime.strptime(tweet['created_at'], "%a %b %d %H:%M:%S +0000 %Y")
tweet['source'] = unescape(tweet['source'])
+ authors[tweet['user']['screen_name']] = tweet['user']['name']
template_values = {
'just_created' : just_created,
'app_url' : app_url,
'page_url' : page_url,
+ 'authors' : authors.values(),
'tweets' : tweets
}
path = os.path.join(os.path.dirname(__file__), 'templates/show.html')
View
2  templates/show.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>QuoteURL (for twitter)</title>
+ <title>A Quote from {{authors|inline_list}} on QuoteURL – Conversation Sharing</title>
<link href="/skin/default/style.css" type="text/css" media="screen,projection" rel="stylesheet" />
<link rel="shortcut icon" href="/skin/default/favicon.png" type="image/png" />
</head>
Please sign in to comment.
Something went wrong with that request. Please try again.