Skip to content

Commit ee83b7d

Browse files
committed
decode percent encoding for display
1 parent 76283b1 commit ee83b7d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

application/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
from google.appengine.ext import db
10+
import urllib
1011

1112

1213
class Link(db.Model):
@@ -16,3 +17,6 @@ class Link(db.Model):
1617
created_at = db.DateTimeProperty(auto_now_add=True)
1718
updated_at = db.DateTimeProperty(auto_now_add=True)
1819

20+
@property
21+
def link_text(self):
22+
return urllib.unquote(str(self.link_url)).decode('utf-8')

application/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h1>Links of <small>{{view_today|datetimeformat}} ({{g.tz.zone}})</small></h1>
1717
<tbody>
1818
{% for link in links%}
1919
<tr>
20-
<td class="td_link"><a rel="noreferrer" href="{{link.link_url}}">{{ link.link_url}}</a></td>
20+
<td class="td_link"><a rel="noreferrer" href="{{link.link_url}}">{{ link.link_text}}</a></td>
2121
<td><time datetime="{{link.created_at}}">{{link.updated_at|datetimeformat('%H:%M')}}</time></td>
2222
<td>
2323
{% for author in link.authors %}

0 commit comments

Comments
 (0)