Remove missing optional files from content.json on cloning
This commit is contained in:
parent
eae6a34bfc
commit
cf7d194dbf
2 changed files with 6 additions and 2 deletions
|
@ -681,13 +681,13 @@ class Site(object):
|
||||||
delete_removed_files=False, load_includes=False
|
delete_removed_files=False, load_includes=False
|
||||||
)
|
)
|
||||||
if privatekey:
|
if privatekey:
|
||||||
new_site.content_manager.sign(file_inner_path.replace("-default", ""), privatekey)
|
new_site.content_manager.sign(file_inner_path.replace("-default", ""), privatekey, remove_missing_optional=True)
|
||||||
new_site.content_manager.loadContent(
|
new_site.content_manager.loadContent(
|
||||||
file_inner_path, add_bad_files=False, delete_removed_files=False, load_includes=False
|
file_inner_path, add_bad_files=False, delete_removed_files=False, load_includes=False
|
||||||
)
|
)
|
||||||
|
|
||||||
if privatekey:
|
if privatekey:
|
||||||
new_site.content_manager.sign("content.json", privatekey)
|
new_site.content_manager.sign("content.json", privatekey, remove_missing_optional=True)
|
||||||
new_site.content_manager.loadContent(
|
new_site.content_manager.loadContent(
|
||||||
"content.json", add_bad_files=False, delete_removed_files=False, load_includes=False
|
"content.json", add_bad_files=False, delete_removed_files=False, load_includes=False
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,6 +29,10 @@ class TestSite:
|
||||||
assert new_site.storage.verifyFiles()["bad_files"] == [] # No bad files allowed
|
assert new_site.storage.verifyFiles()["bad_files"] == [] # No bad files allowed
|
||||||
assert new_site.storage.query("SELECT * FROM keyvalue WHERE key = 'title'").fetchone()["value"] == "MyZeroBlog"
|
assert new_site.storage.query("SELECT * FROM keyvalue WHERE key = 'title'").fetchone()["value"] == "MyZeroBlog"
|
||||||
|
|
||||||
|
# Optional files should be removed
|
||||||
|
|
||||||
|
assert len(new_site.storage.loadJson("content.json").get("files_optional", {})) == 0
|
||||||
|
|
||||||
# Test re-cloning (updating)
|
# Test re-cloning (updating)
|
||||||
|
|
||||||
# Changes in non-data files should be overwritten
|
# Changes in non-data files should be overwritten
|
||||||
|
|
Loading…
Reference in a new issue