corrections
Browse files- dropbox_handler.py +6 -2
dropbox_handler.py
CHANGED
@@ -48,8 +48,8 @@ def getDropboxFilename(localFilename):
|
|
48 |
def getLocalFilename(dropboxFilename):
|
49 |
""" localFilename is $DROP_DIR2/<subpath>/<filename>"""
|
50 |
""" dropboxFilename is $APP_PATH/<subpath>/<filename"""
|
51 |
-
if not
|
52 |
-
|
53 |
dropboxFilename=normalizeFilename(dropboxFilename)
|
54 |
return normalizeFilename(dropboxFilename.replace(os.environ['APP_PATH'],"/",1).replace("/",os.environ['DROP_DIR2'],1))
|
55 |
|
@@ -107,6 +107,8 @@ def restoreFile(dropboxFilename):
|
|
107 |
def backupFolder(localFolder):
|
108 |
""" list all files in folder and subfolder and upload them"""
|
109 |
print("backup folder called for ",localFolder)
|
|
|
|
|
110 |
filenames=[]
|
111 |
for (root,dirs,files) in os.walk(localFolder, topdown=True):
|
112 |
print(root)
|
@@ -119,6 +121,8 @@ def backupFolder(localFolder):
|
|
119 |
def restoreFolder(dropboxFolder):
|
120 |
""" list all files in dropbox folder and subfolders and restore them"""
|
121 |
global TOKEN
|
|
|
|
|
122 |
try:
|
123 |
res=dbx.files_list_folder(dropboxFolder)
|
124 |
if (TOKEN != dbx._oauth2_access_token):
|
|
|
48 |
def getLocalFilename(dropboxFilename):
|
49 |
""" localFilename is $DROP_DIR2/<subpath>/<filename>"""
|
50 |
""" dropboxFilename is $APP_PATH/<subpath>/<filename"""
|
51 |
+
if not dropboxFilename.startsWith(os.environ['APP_PATH']):
|
52 |
+
dropboxFilename=os.environ['APP_PATH']+dropboxFilename
|
53 |
dropboxFilename=normalizeFilename(dropboxFilename)
|
54 |
return normalizeFilename(dropboxFilename.replace(os.environ['APP_PATH'],"/",1).replace("/",os.environ['DROP_DIR2'],1))
|
55 |
|
|
|
107 |
def backupFolder(localFolder):
|
108 |
""" list all files in folder and subfolder and upload them"""
|
109 |
print("backup folder called for ",localFolder)
|
110 |
+
if not localFolder.startsWith(os.environ['DROP_DIR2']):
|
111 |
+
localFolder=os.environ['DROP_DIR2']+localFolder
|
112 |
filenames=[]
|
113 |
for (root,dirs,files) in os.walk(localFolder, topdown=True):
|
114 |
print(root)
|
|
|
121 |
def restoreFolder(dropboxFolder):
|
122 |
""" list all files in dropbox folder and subfolders and restore them"""
|
123 |
global TOKEN
|
124 |
+
if not dropboxFolder.startsWith(os.environ['APP_PATH']):
|
125 |
+
dropboxFolder=os.environ['APP_PATH']+dropboxFolder
|
126 |
try:
|
127 |
res=dbx.files_list_folder(dropboxFolder)
|
128 |
if (TOKEN != dbx._oauth2_access_token):
|