GTG

Merge lp:~jml/gtg/deepcopy-398360 into lp:~gtg/gtg/old-trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jml/gtg/deepcopy-398360
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~jml/gtg/deepcopy-398360
Reviewer Review Type Date Requested Status
Gtg developers Pending
Review via email: mp+8630@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

This branch deletes the 'listes' module from GTG.tools and replaces all calls to returnlist with calls to copy.deepcopy.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/core/requester.py'
2--- GTG/core/requester.py 2009-03-29 19:32:59 +0000
3+++ GTG/core/requester.py 2009-07-12 07:14:42 +0000
4@@ -18,7 +18,8 @@
5 # -----------------------------------------------------------------------------
6
7
8-from GTG.tools.listes import *
9+from copy import deepcopy
10+
11 #Requester is a pure View object. It will not do anything but it will
12 #be used by any Interface to handle the requests to the datastore
13
14@@ -179,7 +180,7 @@
15
16 #Not used currently because it returns every tag that was ever used
17 def get_all_tags(self):
18- return returnlist(self.ds.get_tagstore().get_all_tags())
19+ return deepcopy(self.ds.get_tagstore().get_all_tags())
20
21 def get_notag_tag(self) :
22 return self.ds.get_tagstore().get_notag_tag()
23
24=== modified file 'GTG/core/task.py'
25--- GTG/core/task.py 2009-04-15 13:20:00 +0000
26+++ GTG/core/task.py 2009-07-12 07:14:42 +0000
27@@ -17,10 +17,10 @@
28 # this program. If not, see <http://www.gnu.org/licenses/>.
29 # -----------------------------------------------------------------------------
30
31+from copy import deepcopy
32 from datetime import date
33 import xml.dom.minidom
34
35-from GTG.tools.listes import *
36 from GTG.tools.dates import *
37
38 #This class represent a task in GTG.
39@@ -318,7 +318,7 @@
40 return zelist
41
42 def get_subtasks_tid(self) :
43- return returnlist(self.children)
44+ return deepcopy(self.children)
45
46
47 #add and remove parents are private
48@@ -345,7 +345,7 @@
49 parent.sync()
50
51 def get_parents(self):
52- return returnlist(self.parents)
53+ return deepcopy(self.parents)
54
55 #Return true is the task has parent
56 #If tag is provided, return True only
57@@ -398,7 +398,7 @@
58
59 #return a copy of the list of tag objects
60 def get_tags(self) :
61- return returnlist(self.tags)
62+ return deepcopy(self.tags)
63
64 #This function add tag by name
65 def add_tag(self, tagname):
66
67=== removed file 'GTG/tools/listes.py'
68--- GTG/tools/listes.py 2009-03-01 14:09:12 +0000
69+++ GTG/tools/listes.py 1970-01-01 00:00:00 +0000
70@@ -1,30 +0,0 @@
71-# -*- coding: utf-8 -*-
72-# -----------------------------------------------------------------------------
73-# Gettings Things Gnome! - a personnal organizer for the GNOME desktop
74-# Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau
75-#
76-# This program is free software: you can redistribute it and/or modify it under
77-# the terms of the GNU General Public License as published by the Free Software
78-# Foundation, either version 3 of the License, or (at your option) any later
79-# version.
80-#
81-# This program is distributed in the hope that it will be useful, but WITHOUT
82-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
83-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
84-# details.
85-#
86-# You should have received a copy of the GNU General Public License along with
87-# this program. If not, see <http://www.gnu.org/licenses/>.
88-# -----------------------------------------------------------------------------
89-
90-#Return a copy of the list and avoid a to keep the same object
91-#It handles multilple dimension matrix through recursion
92-def returnlist(liste) :
93- if liste.__class__ is list :
94- to_return = []
95- for i in liste :
96- elem = returnlist(i)
97- to_return.append(elem)
98- else :
99- to_return = liste
100- return to_return

Subscribers

People subscribed via source and target branches

to status/vote changes: