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):
|
def removeContent(self, inner_path):
|
||||||
inner_dir = helper.getDirname(inner_path)
|
inner_dir = helper.getDirname(inner_path)
|
||||||
|
try:
|
||||||
content = self.contents[inner_path]
|
content = self.contents[inner_path]
|
||||||
files = dict(
|
files = dict(
|
||||||
content.get("files", {}),
|
content.get("files", {}),
|
||||||
**content.get("files_optional", {})
|
**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
|
files["content.json"] = True
|
||||||
# Deleting files that no longer in content.json
|
# Deleting files that no longer in content.json
|
||||||
for file_relative_path in files:
|
for file_relative_path in files:
|
||||||
|
@ -236,7 +240,11 @@ class ContentManager(object):
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
self.log.debug("Error deleting dir %s: %s" % (inner_dir, err))
|
self.log.debug("Error deleting dir %s: %s" % (inner_dir, err))
|
||||||
|
|
||||||
|
try:
|
||||||
del self.contents[inner_path]
|
del self.contents[inner_path]
|
||||||
|
except Exception, err:
|
||||||
|
self.log.debug("Error key from contents: %s" % inner_path)
|
||||||
|
|
||||||
|
|
||||||
# Get total size of site
|
# Get total size of site
|
||||||
# Return: 32819 (size of files in kb)
|
# Return: 32819 (size of files in kb)
|
||||||
|
|
|
@ -175,7 +175,7 @@ class SiteStorage(object):
|
||||||
def delete(self, inner_path):
|
def delete(self, inner_path):
|
||||||
file_path = self.getPath(inner_path)
|
file_path = self.getPath(inner_path)
|
||||||
os.unlink(file_path)
|
os.unlink(file_path)
|
||||||
self.onUpdated(inner_path)
|
self.onUpdated(inner_path, file=False)
|
||||||
|
|
||||||
def deleteDir(self, inner_path):
|
def deleteDir(self, inner_path):
|
||||||
dir_path = self.getPath(inner_path)
|
dir_path = self.getPath(inner_path)
|
||||||
|
|
Loading…
Reference in a new issue