Add support for the parallel/serial suffixes to be configurable.

master
Andrew Williams 2015-08-29 18:24:19 +01:00
parent 39bedda786
commit 990b0190bc
2 changed files with 15 additions and 3 deletions

View File

@ -22,6 +22,16 @@
"description": "What method to use for the Inbox, sequence or parallel",
"value": "parallel",
"required": false
},
"TODODIST_PARALLEL_SUFFIX": {
"description": "What sequence of characters to use to identify parallel processed projects",
"value": "=",
"required": false
},
"TODODIST_SERIAL_SUFFIX": {
"description": "What sequence of characters to use to identify serial processed projects",
"value": "-",
"required": false
}
}
}

View File

@ -12,15 +12,17 @@ API_TOKEN = os.environ.get('TODOIST_API_KEY', None)
NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action')
SYNC_DELAY = int(os.environ.get('TODOIST_SYNC_DELAY', '5'))
INBOX_HANDLING = os.environ.get('TODOIST_INBOX_HANDLING', 'parallel')
PARALLEL_SUFFIX = os.environ.get('TODOIST_PARALLEL_SUFFIX', '=')
SERIAL_SUFFIX = os.environ.get('TODOIST_SERIAL_SUFFIX', '-')
def get_project_type(project):
"""Identifies how a project should be handled"""
name = project['name'].strip()
if project['name'] == 'Inbox':
return INBOX_HANDLING
elif name[-1] == '=':
elif name[-1] == PARALLEL_SUFFIX:
return 'parallel'
elif name[-1] == '-':
elif name[-1] == SERIAL_SUFFIX:
return 'serial'