Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,34 +177,38 @@ def addContext(self, data):


def buildXml(self, todo):

xml = '<todo>'
if todo.getDescription() != None:
xml += '<description>' + todo.getDescription() + '</description>'
if todo['description'] != None:
xml += '<description>' + todo['description'] + '</description>'

if todo['notes'] != None:
xml += '<notes>' + todo['notes'] + '</notes>'

if todo.getProject() != None:
if todo.getProject() == 'default':
if todo['project'] != None:
if todo['project'] == 'default':
xml += '<project_id>1</project_id>'
else:
for project in self.projects:
if project['name'] == todo.getProject():
if project['name'] == todo['project']:
xml += '<project_id>' + project['id'] + '</project_id>'
break

if todo.getContext() != None:
if todo.getContext() == 'default':
if todo['context'] != None:
if todo['context'] == 'default':
xml += '<context_id>1</context_id>'
else:
for context in self.contexts:
if context['name'] == todo.getContext():
if context['name'] == todo['context']:
xml += '<context_id>' + context['id'] + '</context_id>'
break

if todo.isDone() == True:
if todo['done'] == True:
xml += '<state>completed</state>'
xml += "<completed-at type='datetime'>"+ todo.getCompletedDate() + 'T00:00:00Z'+"</completed-at>"

xml += '</todo>'
xml = unicode(xml).encode('unicode_escape')
xml = unicode(xml).encode('raw-unicode-escape')
return xml

def updateTodo(self, todo):
Expand Down