Cosmetic cleanup

This commit is contained in:
Ross Scroggs
2016-03-17 16:22:15 -07:00
parent 6b0fce21a5
commit a3c509ce61

View File

@ -4471,7 +4471,7 @@ def labelsToLabelIds(gmail, labels):
if label not in allLabels: if label not in allLabels:
# first refresh labels in user mailbox # first refresh labels in user mailbox
label_results = callGAPI(gmail.users().labels(), 'list', label_results = callGAPI(gmail.users().labels(), 'list',
userId='me', fields='labels(name,id,type)') userId='me', fields='labels(name,id,type)')
for a_label in label_results['labels']: for a_label in label_results['labels']:
if a_label['type'] == 'system': if a_label['type'] == 'system':
allLabels[a_label['id']] = a_label['id'] allLabels[a_label['id']] = a_label['id']
@ -4479,9 +4479,9 @@ def labelsToLabelIds(gmail, labels):
allLabels[a_label['name']] = a_label['id'] allLabels[a_label['name']] = a_label['id']
if label not in allLabels: if label not in allLabels:
# if still not there, create it # if still not there, create it
label_results = callGAPI(service=gmail.users().labels(), function='create', label_results = callGAPI(gmail.users().labels(), 'create',
body={'labelListVisibility': 'labelShow', body={'labelListVisibility': 'labelShow',
'messageListVisibility': 'show', 'name': label}, 'messageListVisibility': 'show', 'name': label},
userId='me', fields='id') userId='me', fields='id')
allLabels[label] = label_results['id'] allLabels[label] = label_results['id']
try: try:
@ -4493,8 +4493,8 @@ def labelsToLabelIds(gmail, labels):
parent_label = label[:label.rfind('/')] parent_label = label[:label.rfind('/')]
while True: while True:
if not parent_label in allLabels: if not parent_label in allLabels:
label_result = callGAPI(service=gmail.users().labels(), label_result = callGAPI(service=gmail.users().labels(), 'create',
function='create', userId='me', body={'name': parent_label}) userId='me', body={'name': parent_label})
allLabels[parent_label] = label_result['id'] allLabels[parent_label] = label_result['id']
if parent_label.find('/') == -1: if parent_label.find('/') == -1:
break break