Fix content deletion
This commit is contained in:
parent
14544922bf
commit
9fd19bf382
2 changed files with 15 additions and 7 deletions
|
@ -217,11 +217,15 @@ class ContentManager(object):
|
|||
|
||||
def removeContent(self, inner_path):
|
||||
inner_dir = helper.getDirname(inner_path)
|
||||
try:
|
||||
content = self.contents[inner_path]
|
||||
files = dict(
|
||||
content.get("files", {}),
|
||||
**content.get("files_optional", {})
|
||||
)
|
||||
except Exception, err:
|
||||
self.log.debug("Error loading %s for removeContent: %s" % (inner_path, Debug.formatException(err)))
|
||||
files = {}
|
||||
files["content.json"] = True
|
||||
# Deleting files that no longer in content.json
|
||||
for file_relative_path in files:
|
||||
|
@ -236,7 +240,11 @@ class ContentManager(object):
|
|||
except Exception, err:
|
||||
self.log.debug("Error deleting dir %s: %s" % (inner_dir, err))
|
||||
|
||||
try:
|
||||
del self.contents[inner_path]
|
||||
except Exception, err:
|
||||
self.log.debug("Error key from contents: %s" % inner_path)
|
||||
|
||||
|
||||
# Get total size of site
|
||||
# Return: 32819 (size of files in kb)
|
||||
|
|
|
@ -175,7 +175,7 @@ class SiteStorage(object):
|
|||
def delete(self, inner_path):
|
||||
file_path = self.getPath(inner_path)
|
||||
os.unlink(file_path)
|
||||
self.onUpdated(inner_path)
|
||||
self.onUpdated(inner_path, file=False)
|
||||
|
||||
def deleteDir(self, inner_path):
|
||||
dir_path = self.getPath(inner_path)
|
||||
|
|
Loading…
Reference in a new issue