From 7a5d729859a2f667658532303c2616a38f781dd2 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 26 Feb 2011 22:39:22 +0100 Subject: 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. --- db.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'db.py') 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 -- cgit v1.2.3