create empty prop if not exist
This commit is contained in:
parent
7a75569e5d
commit
87a5ab0b07
@ -33,11 +33,15 @@ def main():
|
|||||||
try:
|
try:
|
||||||
webapp = user.store.prop(0X6773001F).value
|
webapp = user.store.prop(0X6773001F).value
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
print('Property PR_EC_RECIPIENT_HISTORY_JSON_W not found. User might have never used recipient history before.', file=sys.stderr)
|
webapp = dict(recipients=[])
|
||||||
sys.exit(1)
|
|
||||||
webapp = json.loads(webapp)
|
webapp = json.loads(webapp)
|
||||||
|
|
||||||
if options.backup:
|
if options.backup:
|
||||||
|
if len(webapp['recipients']) == 0:
|
||||||
|
print('Property PR_EC_RECIPIENT_HISTORY_JSON_W not found . User might have never used recipient history before.', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
f = open('%s.json' % user.name, 'w')
|
f = open('%s.json' % user.name, 'w')
|
||||||
f.write(json.dumps(webapp, sort_keys=True,
|
f.write(json.dumps(webapp, sort_keys=True,
|
||||||
indent=4, separators=(',', ': ')))
|
indent=4, separators=(',', ': ')))
|
||||||
|
Loading…
Reference in New Issue
Block a user