← Back to team overview

gtg team mailing list archive

[Merge] lp:~khaeru/gtg/req-new-task into lp:gtg

 

Paul Kishimoto has proposed merging lp:~khaeru/gtg/req-new-task into lp:gtg.

Requested reviews:
  Gtg developers (gtg)


Requester.new_task() has a boolean argument newtask=True.

It used to be that this function would call Datastore.new_task(), passing on the newtask argument. But as of r825 (a large merge related to multi-backends, http://bazaar.launchpad.net/~gtg/gtg/trunk/revision/825), that no longer happens.

So the argument has no function, but many invocations of Requester.new_task() still use it. This branch removes both the argument and any references to it.
-- 
https://code.launchpad.net/~khaeru/gtg/req-new-task/+merge/29801
Your team Gtg developers is requested to review the proposed merge of lp:~khaeru/gtg/req-new-task into lp:gtg.
=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py	2010-06-22 19:55:15 +0000
+++ GTG/core/requester.py	2010-07-13 15:34:43 +0000
@@ -170,7 +170,7 @@
         task = self.ds.get_task(tid)
         return task
 
-    def new_task(self, tags=None, newtask=True):
+    def new_task(self, tags=None):
         """Create a new task.
 
         Note: this modifies the datastore.
@@ -179,8 +179,6 @@
         @param tags: The tags for the new task. If not provided, then the
             task will have no tags. Tags must be an iterator type containing
             the tags tids
-        @param newtask: C{True} if this is creating a new task that never
-            existed, C{False} if importing an existing task from a backend.
         @return: A task from the data store
         """
         task = self.ds.new_task()

=== modified file 'GTG/core/task.py'
--- GTG/core/task.py	2010-07-01 09:59:33 +0000
+++ GTG/core/task.py	2010-07-13 15:34:43 +0000
@@ -312,7 +312,7 @@
         """Add a newly created subtask to this task. Return the task added as
         a subtask
         """
-        subt     = self.req.new_task(newtask=True)
+        subt = self.req.new_task()
         #we use the inherited childrens
         self.add_child(subt.get_id())
         return subt

=== modified file 'GTG/gtk/browser/browser.py'
--- GTG/gtk/browser/browser.py	2010-06-22 23:31:19 +0000
+++ GTG/gtk/browser/browser.py	2010-07-13 15:34:43 +0000
@@ -954,7 +954,7 @@
                     text = \
                         text.replace("%s%s:%s" % (spaces, attribute, args), "")
             # Create the new task
-            task = self.req.new_task(tags=[t.get_name() for t in tags], newtask=True)
+            task = self.req.new_task(tags=[t.get_name() for t in tags])
             if text != "":
                 task.set_title(text.strip())
                 task.set_to_keep()
@@ -1067,7 +1067,7 @@
 
     def on_add_task(self, widget, status=None):
         tags, notagonly = self.get_selected_tags()
-        task = self.req.new_task(tags=[t.get_name() for t in tags], newtask=True)
+        task = self.req.new_task(tags=[t.get_name() for t in tags])
         uid = task.get_id()
         if status:
             task.set_status(status)
@@ -1078,7 +1078,7 @@
         if uid:
             zetask = self.req.get_task(uid)
             tags   = zetask.get_tags()
-            task   = self.req.new_task(tags=[t.get_name() for t in tags], newtask=True)
+            task   = self.req.new_task(tags=[t.get_name() for t in tags])
             #task.add_parent(uid)
             zetask.add_child(task.get_id())
             self.vmanager.open_task(task.get_id(),thisisnew=True)

=== modified file 'GTG/gtk/dbuswrapper.py'
--- GTG/gtk/dbuswrapper.py	2010-06-10 14:45:36 +0000
+++ GTG/gtk/dbuswrapper.py	2010-07-13 15:34:43 +0000
@@ -217,7 +217,7 @@
 
         This routine returns as soon as the GUI has launched.
         """
-        nt = self.req.new_task(newtask=True)
+        nt = self.req.new_task()
         nt.set_title(title)
         if description != "":
             nt.set_text(description)

=== modified file 'GTG/gtk/editor/editor.py'
--- GTG/gtk/editor/editor.py	2010-07-06 04:01:50 +0000
+++ GTG/gtk/editor/editor.py	2010-07-13 15:34:43 +0000
@@ -546,12 +546,12 @@
             tid = subt.get_id()
         return tid
 
-    # Create a new task
     def new_task(self, *args):
-        task = self.req.new_task(newtask=True)
+        """Create a new task."""
+        task = self.req.new_task()
         task_id = task.get_id()
         self.vmanager.open_task(task_id)
-        
+
     def insert_subtask(self,widget) : #pylint: disable-msg=W0613
         self.textview.insert_newtask()
         self.textview.grab_focus()

=== modified file 'GTG/plugins/evolution_sync/gtgProxy.py'
--- GTG/plugins/evolution_sync/gtgProxy.py	2010-03-16 02:16:14 +0000
+++ GTG/plugins/evolution_sync/gtgProxy.py	2010-07-13 15:34:43 +0000
@@ -35,8 +35,8 @@
         map(lambda task: self._tasks_list.append(GtgTask(task, \
                                         self.plugin_api, self)), tasks)
 
-    def create_new_task(self, title, never_seen_before = True):
-        new_gtg_local_task = self.requester.new_task(newtask=never_seen_before)
+    def create_new_task(self, title):
+        new_gtg_local_task = self.requester.new_task()
         new_task = GtgTask(new_gtg_local_task, self.plugin_api, self)
         new_task.title = title
         self._tasks_list.append(new_task)

=== modified file 'GTG/plugins/import_json/import_json.py'
--- GTG/plugins/import_json/import_json.py	2010-04-27 02:52:37 +0000
+++ GTG/plugins/import_json/import_json.py	2010-07-13 15:34:43 +0000
@@ -202,7 +202,8 @@
                     text = spec['details_url']
                 elif spec['url']:
                     text = spec['url']
-                task = self.plugin_api.get_requester().new_task(pid=None, tags=None, newtask=True)
+                task = self.plugin_api.get_requester().new_task(pid=None,
+                  tags=None)
                 task.set_title(re_dehtml.sub('', wi['description']))
                 task.set_text(re_dehtml.sub('', text))
                 task.sync()

=== modified file 'GTG/plugins/rtm_sync/gtgProxy.py'
--- GTG/plugins/rtm_sync/gtgProxy.py	2010-03-21 18:06:10 +0000
+++ GTG/plugins/rtm_sync/gtgProxy.py	2010-07-13 15:34:43 +0000
@@ -38,8 +38,8 @@
         map(lambda task: self._tasks_list.append(GtgTask(task, \
                                         self.plugin_api, self)), tasks)
 
-    def create_new_task(self, title, never_seen_before = True):
-        new_gtg_local_task = self.requester.new_task(newtask = never_seen_before)
+    def create_new_task(self, title):
+        new_gtg_local_task = self.requester.new_task()
         new_task = GtgTask(new_gtg_local_task, self.plugin_api, self)
         new_task.title = title
         self._tasks_list.append(new_task)

=== modified file 'GTG/tests/test_backends.py'
--- GTG/tests/test_backends.py	2010-06-23 12:49:28 +0000
+++ GTG/tests/test_backends.py	2010-07-13 15:34:43 +0000
@@ -121,7 +121,7 @@
 #                dic["filename"] = self.taskfile
 #        beobj = localfile.Backend(dic)
 #        dstore = datastore.DataStore()
-#        newtask = dstore.new_task(tid="0@2", pid="1", newtask=True)
+#        newtask = dstore.new_task(tid="0@2", pid="1")
 #        beobj.get_task(newtask, "0@1")
 #        self.assertEqual(newtask.get_title(), u"Ceci est un test")
 
@@ -141,7 +141,7 @@
 #                dic["filename"] = self.taskfile
 #        beobj = localfile.Backend(dic)
 #        dstore = datastore.DataStore()
-#        newtask = dstore.new_task(tid="0@2", pid="1", newtask=True)
+#        newtask = dstore.new_task(tid="0@2", pid="1")
 #        beobj.set_task(newtask)
 #        dataline = open(self.taskpath, 'r').read()
 #        if "0@2" in dataline:


Follow ups