Browse Source

don't delete a folder that doesn't exist

current_wdka_release
crunk 3 years ago
parent
commit
76de0b10cb
  1. 2
      verse/adminpage.py
  2. 3
      verse/distribusiselector.py
  3. 1
      verse/upload.py

2
verse/adminpage.py

@ -107,8 +107,10 @@ def DeleteDistribusiFromDb(distribusi):
def DeleteDistribusiFiles(distribusiname): def DeleteDistribusiFiles(distribusiname):
userfolder = os.path.join("stash", distribusiname) userfolder = os.path.join("stash", distribusiname)
if os.path.exists(userfolder):
shutil.rmtree(userfolder) shutil.rmtree(userfolder)
cssfolder = os.path.join("themes/userthemes", distribusiname) cssfolder = os.path.join("themes/userthemes", distribusiname)
if os.path.exists(cssfolder):
shutil.rmtree(cssfolder) shutil.rmtree(cssfolder)

3
verse/distribusiselector.py

@ -83,15 +83,18 @@ def DeleteDistribusi(distribusiname):
db.session.delete(distribusi) db.session.delete(distribusi)
db.session.commit() db.session.commit()
userfolder = os.path.join("stash", distribusi.distribusiname) userfolder = os.path.join("stash", distribusi.distribusiname)
if os.path.exists(userfolder):
shutil.rmtree(userfolder) shutil.rmtree(userfolder)
cssfolder = os.path.join( cssfolder = os.path.join(
"themes/userthemes", distribusi.distribusiname "themes/userthemes", distribusi.distribusiname
) )
if os.path.exists(cssfolder):
shutil.rmtree(cssfolder) shutil.rmtree(cssfolder)
if distribusi.publictheme is not None: if distribusi.publictheme is not None:
publicthemefolder = os.path.join( publicthemefolder = os.path.join(
"themes/publicthemes", distribusi.distribusiname "themes/publicthemes", distribusi.distribusiname
) )
if os.path.exists(publicthemefolder):
shutil.rmtree(publicthemefolder) shutil.rmtree(publicthemefolder)
# SelectField error is list is a tuple?? why?? # SelectField error is list is a tuple?? why??
# selectorform.distribusis.errors.append("Distribusi deleted!") # selectorform.distribusis.errors.append("Distribusi deleted!")

1
verse/upload.py

@ -86,6 +86,7 @@ def UploadUpdatedFiles(uploadfolder):
zipfile.save(os.path.join(uploadfolder, zipfilename)) zipfile.save(os.path.join(uploadfolder, zipfilename))
newuserfolder = os.path.join("stash", distribusi.distribusiname) newuserfolder = os.path.join("stash", distribusi.distribusiname)
if os.path.exists(newuserfolder):
shutil.rmtree(newuserfolder) shutil.rmtree(newuserfolder)
os.mkdir(newuserfolder) os.mkdir(newuserfolder)

Loading…
Cancel
Save