def configupdate(dictID, user, dictDB, configs): adjustedJson, resaveNeeded = ops.updateDictConfig( dictDB, dictID, request.forms.id, json.loads(request.forms.content)) if resaveNeeded: configs = ops.readDictConfigs(dictDB) ops.resave(dictDB, dictID, configs) return {"success": True, "id": request.forms.id, "content": adjustedJson}
def resavejson(dictID, user, dictDB, configs): count = 0 stats = ops.getDictStats(dictDB) while stats["needResave"] and count <= 127: ops.refac(dictDB, dictID, configs) ops.refresh(dictDB, dictID, configs) ops.resave(dictDB, dictID, configs) stats = ops.getDictStats(dictDB) count += 1 return {"todo": stats["needResave"]}