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
=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py 2009-03-29 19:32:59 +0000
+++ GTG/core/requester.py 2009-07-12 07:14:42 +0000
@@ -18,7 +18,8 @@
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
2020
21from GTG.tools.listes import *21from copy import deepcopy
22
22#Requester is a pure View object. It will not do anything but it will23#Requester is a pure View object. It will not do anything but it will
23#be used by any Interface to handle the requests to the datastore24#be used by any Interface to handle the requests to the datastore
2425
@@ -179,7 +180,7 @@
179 180
180 #Not used currently because it returns every tag that was ever used181 #Not used currently because it returns every tag that was ever used
181 def get_all_tags(self):182 def get_all_tags(self):
182 return returnlist(self.ds.get_tagstore().get_all_tags())183 return deepcopy(self.ds.get_tagstore().get_all_tags())
183 184
184 def get_notag_tag(self) :185 def get_notag_tag(self) :
185 return self.ds.get_tagstore().get_notag_tag()186 return self.ds.get_tagstore().get_notag_tag()
186187
=== modified file 'GTG/core/task.py'
--- GTG/core/task.py 2009-04-15 13:20:00 +0000
+++ GTG/core/task.py 2009-07-12 07:14:42 +0000
@@ -17,10 +17,10 @@
17# this program. If not, see <http://www.gnu.org/licenses/>.17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------18# -----------------------------------------------------------------------------
1919
20from copy import deepcopy
20from datetime import date21from datetime import date
21import xml.dom.minidom22import xml.dom.minidom
2223
23from GTG.tools.listes import *
24from GTG.tools.dates import *24from GTG.tools.dates import *
2525
26#This class represent a task in GTG.26#This class represent a task in GTG.
@@ -318,7 +318,7 @@
318 return zelist318 return zelist
319 319
320 def get_subtasks_tid(self) :320 def get_subtasks_tid(self) :
321 return returnlist(self.children)321 return deepcopy(self.children)
322 322
323 323
324 #add and remove parents are private324 #add and remove parents are private
@@ -345,7 +345,7 @@
345 parent.sync()345 parent.sync()
346 346
347 def get_parents(self):347 def get_parents(self):
348 return returnlist(self.parents)348 return deepcopy(self.parents)
349 349
350 #Return true is the task has parent350 #Return true is the task has parent
351 #If tag is provided, return True only351 #If tag is provided, return True only
@@ -398,7 +398,7 @@
398 398
399 #return a copy of the list of tag objects399 #return a copy of the list of tag objects
400 def get_tags(self) :400 def get_tags(self) :
401 return returnlist(self.tags)401 return deepcopy(self.tags)
402402
403 #This function add tag by name403 #This function add tag by name
404 def add_tag(self, tagname):404 def add_tag(self, tagname):
405405
=== removed file 'GTG/tools/listes.py'
--- GTG/tools/listes.py 2009-03-01 14:09:12 +0000
+++ GTG/tools/listes.py 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
1# -*- coding: utf-8 -*-
2# -----------------------------------------------------------------------------
3# Gettings Things Gnome! - a personnal organizer for the GNOME desktop
4# Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau
5#
6# This program is free software: you can redistribute it and/or modify it under
7# the terms of the GNU General Public License as published by the Free Software
8# Foundation, either version 3 of the License, or (at your option) any later
9# version.
10#
11# This program is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14# details.
15#
16# You should have received a copy of the GNU General Public License along with
17# this program. If not, see <http://www.gnu.org/licenses/>.
18# -----------------------------------------------------------------------------
19
20#Return a copy of the list and avoid a to keep the same object
21#It handles multilple dimension matrix through recursion
22def returnlist(liste) :
23 if liste.__class__ is list :
24 to_return = []
25 for i in liste :
26 elem = returnlist(i)
27 to_return.append(elem)
28 else :
29 to_return = liste
30 return to_return

Subscribers

People subscribed via source and target branches

to status/vote changes: