-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.py
58 lines (43 loc) · 1.59 KB
/
db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python
#
# I'm interface. Don't import me directly.
class Db():
EXISTED = -2 # Only used for create new file/directory.
NOT_EXIST = -1
DIR = 1
FILE = 2
def safe_path(self, path):
return "/".join([p for p in path if len(p) and p[0] != "."])
def get_dir(self, path):
raise Exception("Please implement Db.get)dir()")
def get_file(self, path):
raise Exception("Please implement Db.get_file()")
# Returns the timestamp value (seconds, in GTM)
def get_last_modified(self, path):
raise Exception("Please implement Db.get_last_modified()")
def put_dir(self, path):
raise Exception("Please implement Db.put_dir()")
def put_file(self, path):
raise Exception("Please implement Db.put_file()")
def updatefile(self, path):
raise Exception("Please implement Db.update_file()")
def delete_dir(self, path):
raise Exception("Please implement Db.delete_dir()")
def delete_file(self, path):
raise Exception("Please implement Db.delete_file()")
def post_file(self, path):
raise Exception("Please implement Db.post_file()")
def need_authentication(self, path):
"""
Return if the path requires user to authenticate itself.
"""
raise Exception("Please implement Db.need_authentication()")
def get_password(self, userpath):
"""
Return the password for the userpath.
Return:
None -- This user is not in the access list (not authorized).
"" -- No authenticate is required for this directory.
string -- User's plaintext password.
"""
raise Exception("Please implement Db.get_password()")