~saurabhanandiit/gtg/exportFixed

« back to all changes in this revision

Viewing changes to GTG/tools/taskxml.py

Merge of my work on liblarch newbase and all the backends ported to liblarch
(which mainly means porting the datastore).
One failing test, will check it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#Functions to convert a Task object to an XML string and back
21
21
import xml.dom.minidom
22
22
import xml.sax.saxutils as saxutils
 
23
import datetime
23
24
 
24
25
from GTG.tools import cleanxml
25
26
from GTG.tools import dates
55
56
            content = xml.dom.minidom.parseString(tas)
56
57
            cur_task.set_text(content.firstChild.toxml()) #pylint: disable-msg=E1103 
57
58
    cur_task.set_due_date(dates.strtodate(cleanxml.readTextNode(xmlnode,"duedate")))
58
 
    cur_task.set_modified(cleanxml.readTextNode(xmlnode,"modified"))
59
59
    cur_task.set_start_date(dates.strtodate(cleanxml.readTextNode(xmlnode,"startdate")))
60
60
    cur_tags = xmlnode.getAttribute("tags").replace(' ','').split(",")
61
61
    if "" in cur_tags: cur_tags.remove("")
69
69
            backend_id = node.firstChild.nodeValue
70
70
            remote_task_id = node.childNodes[1].firstChild.nodeValue
71
71
            task.add_remote_id(backend_id, remote_task_id)
 
72
    modified_string = cleanxml.readTextNode(xmlnode,"modified")
 
73
    if modified_string:
 
74
        modified_datetime = datetime.datetime.strptime(modified_string,\
 
75
                                                    "%Y-%m-%dT%H:%M:%S")
 
76
        cur_task.set_modified(modified_datetime)
72
77
    return cur_task
73
78
 
74
79
#Task as parameter the doc where to put the XML node