Pretty printed the info.json when modifying it.

This commit is contained in:
Joachim Nielandt 2018-01-04 20:59:55 +01:00
parent 8446ed6c99
commit e6810b476f
3 changed files with 6 additions and 3 deletions

View File

@ -1 +1,4 @@
{"created_timestamp": 1515094644.214663, "title": "Test title"}
{
"created_timestamp": 1515095948.838848,
"title": "Test title"
}

View File

@ -1 +1 @@
[{"info": {"created_timestamp": 1515094644.214663, "title": "Test title"}, "post": [], "type": "project", "id": "test"}, {"info": {"created_timestamp": 1515094644.215065, "title": "cupboard"}, "post": [], "type": "project", "id": "cupboard1"}, {"info": {"created_timestamp": 1515094644.215333, "title": "some things about lxc in arch"}, "post": [], "type": "tech", "id": "lxdarch"}, {"info": {"test": "some dummy value", "created_timestamp": 1515094679.342938, "title": "Who said Web 1.0 was dead anyway?"}, "post": [], "type": "blog", "id": "first"}]
[{"info": {"created_timestamp": 1515095948.838848, "title": "Test title"}, "post": [], "type": "project", "id": "test"}, {"info": {"created_timestamp": 1515094644.215065, "title": "cupboard"}, "post": [], "type": "project", "id": "cupboard1"}, {"info": {"created_timestamp": 1515094644.215333, "title": "some things about lxc in arch"}, "post": [], "type": "tech", "id": "lxdarch"}, {"info": {"created_timestamp": 1515094679.342938, "title": "Who said Web 1.0 was dead anyway?"}, "post": [], "type": "blog", "id": "first"}]

View File

@ -38,7 +38,7 @@ for type in types:
d['created_timestamp'] = time.time()
# persist it in the json file itself
with open(infofile, 'w') as infooutfile:
json.dump(d, infooutfile)
json.dump(d, infooutfile, sort_keys=True, indent=4, separators=(',', ': '))
# # figure out the last change of any file in the folder
# lastchange = 0;