summaryrefslogtreecommitdiff
path: root/db.py
diff options
context:
space:
mode:
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