# HG changeset patch # User Edouard Tisserant # Date 1543312453 -3600 # Node ID 9624575a9cac1d99e457103ff6956eade5bb6b06 # Parent 89abeece2c71a6200b62e6eda489a474e3d976c3 Cosmetic change in PSKManagement.py diff -r 89abeece2c71 -r 9624575a9cac PSKManagement.py --- a/PSKManagement.py Mon Nov 26 15:12:18 2018 +0100 +++ b/PSKManagement.py Tue Nov 27 10:54:13 2018 +0100 @@ -20,6 +20,12 @@ def _mgtpath(project_path): return os.path.join(_pskpath(project_path), 'management.json') +def _ensurePSKdir(project_path): + pskpath = _pskpath(project_path) + if not os.path.exists(pskpath): + os.mkdir(pskpath) + return pskpath + def _default(ID): return [ID, '', # default description @@ -62,15 +68,12 @@ os.remove(secret_path) def SaveData(project_path, data): - pskpath = _pskpath(project_path) - if not os.path.isdir(pskpath): - os.mkdir(pskpath) + _ensurePSKdir(project_path) with open(_mgtpath(project_path), 'w') as f: f.write(json.dumps(data)) - def UpdateID(project_path, ID, secret, URI): - pskpath = _pskpath(project_path) + pskpath = _ensurePSKdir(project_path) if not os.path.exists(pskpath): os.mkdir(pskpath)