summaryrefslogtreecommitdiff
path: root/db.py
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-02-26 22:39:22 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-02-26 22:39:22 +0100
commit7a5d729859a2f667658532303c2616a38f781dd2 (patch)
tree189dae579b027ad0a22153e40e5b74ae5210ff20 /db.py
parent2b1d2bc45cb09e0df180bcbfdf30859b5ea142c7 (diff)
Added some requests, more details in long description.
- Files are now hashed, when you upload a file with an existing hash you will get the existing file in return (will fix adding files to your account at a later time). - Username can be used instead of uid for cookies, hashing for the identifier works the same way as before, but with username instead of uid if username is used. - Add api=1 to get machine-readable responses, details in are found on the help page.
Diffstat (limited to 'db.py')
-rw-r--r--db.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/db.py b/db.py
index 762fc07..1deb196 100644
--- a/db.py
+++ b/db.py
@@ -27,12 +27,14 @@ class File(Base):
id = Column(Integer, primary_key = True)
hash = Column(String, unique = True, index = True)
+ file_hash = Column(String, unique = True, index = True)
filename = Column(String)
date = Column(DateTime)
user_id = Column(Integer, ForeignKey('users.id'), nullable = True)
- def __init__(self, hash, filename, date, user_id = None):
+ def __init__(self, hash, file_hash, filename, date, user_id = None):
self.hash = hash
+ self.file_hash = file_hash
self.filename = filename
self.date = date
self.user_id = user_id