summaryrefslogtreecommitdiff
path: root/db.py
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2014-02-04 23:13:48 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2014-02-04 23:13:48 +0100
commitd6d22f2c1f10cb19b3976a76d78c20349bb95f76 (patch)
treedde84436aa7684ae9f29de00308a1f4431148f60 /db.py
parent2b57544d7fe37998dab6f54612d5dd10ff3efb8d (diff)
Added lazy load to image page.jabless
Diffstat (limited to 'db.py')
-rw-r--r--db.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/db.py b/db.py
index f571809..fc2db63 100644
--- a/db.py
+++ b/db.py
@@ -73,9 +73,11 @@ class File(Base):
def is_image(self):
return self.get_mime_type().startswith('image')
- def image_html(self):
- return u'<a href="{root}f/{hash}{ext}" title="{filename}"><img src="{root}t/{hash}" alt="{filename}" onerror="thumb_onerror(this)" /></a>'.format(
- root = settings.virtual_root, hash = self.hash, filename = self.filename, ext = os.path.splitext(self.filename)[1])
+ @property
+ def ext(self):
+ return os.path.splitext(self.filename)[1]
Base.metadata.create_all()
Session = sessionmaker(bind = engine, autoflush = True, autocommit = False)
+
+# vim: noet ts=4