Beispiel #1
0
 def test_get_by_shortname_exists(self):
     result = Link.get_by_shortname('foo')
     self.assertEqual(result.__class__, Link)
Beispiel #2
0
 def test_get_by_shortname_nonexistent(self):
     result = Link.get_by_shortname('this does not exist')
     self.assertEqual(result, None)
Beispiel #3
0
def show_shorturl(shorturl):
    link = Link.get_by_shortname(shorturl)
    if link is None:
        abort(404)
    link.get_hit(current_user).add_hit()
    return redirect(link.url)