Putting more under locks
[doneit] / src / rtm_backend.py
index 9d7cb5f..f9aa3d6 100644 (file)
@@ -12,7 +12,7 @@ def fix_url(rturl):
        return "/".join(rturl.split(r"\/"))
 
 
-class RtMilkManager(object):
+class RtmBackend(object):
        """
        Interface with rememberthemilk.com
 
@@ -39,6 +39,12 @@ class RtMilkManager(object):
                self._timeline = resp.timeline
                self._lists = []
 
+       def save(self):
+               pass
+
+       def load(self):
+               pass
+
        def add_project(self, name):
                rsp = self._rtm.lists.add(
                        timeline=self._timeline,
@@ -46,6 +52,7 @@ class RtMilkManager(object):
                )
                assert rsp.stat == "ok", "Bad response: %r" % (rsp, )
                self._lists = []
+               return rsp.list.id
 
        def set_project_name(self, projId, name):
                rsp = self._rtm.lists.setName(
@@ -220,6 +227,9 @@ class RtMilkManager(object):
                        note_text=noteBody,
                )
                assert rsp.stat == "ok", "Bad response: %r" % (rsp, )
+               noteId = rsp.note.id
+
+               return self._pack_ids(projId, seriesId, taskId, noteId)
 
        def update_note(self, noteId, noteTitle, noteBody):
                projId, seriesId, taskId, note = self._unpack_ids(noteId)
@@ -244,7 +254,7 @@ class RtMilkManager(object):
        @staticmethod
        def _pack_ids(*ids):
                """
-               >>> RtMilkManager._pack_ids(123, 456)
+               >>> RtmBackend._pack_ids(123, 456)
                '123-456'
                """
                return "-".join((str(id) for id in ids))
@@ -252,7 +262,7 @@ class RtMilkManager(object):
        @staticmethod
        def _unpack_ids(ids):
                """
-               >>> RtMilkManager._unpack_ids("123-456")
+               >>> RtmBackend._unpack_ids("123-456")
                ['123', '456']
                """
                return ids.split("-")