← Back to team overview

gtg team mailing list archive

[Merge] lp:~qcxhome/gtg/fix-localfile-tasks-storage into lp:gtg

 

Chenxiong Qi has proposed merging lp:~qcxhome/gtg/fix-localfile-tasks-storage into lp:gtg.

Requested reviews:
  Gtg developers (gtg)

For more details, see:
https://code.launchpad.net/~qcxhome/gtg/fix-localfile-tasks-storage/+merge/189834

localfile backend creates gtg_tasks.xml in the current working directory from where gtg is launched. This behavior is not correct as what is described in the backend class definition, that is gtg_tasks.xml should be in `$XDG_DATA_DIR/gtg`.
-- 
https://code.launchpad.net/~qcxhome/gtg/fix-localfile-tasks-storage/+merge/189834
Your team Gtg developers is requested to review the proposed merge of lp:~qcxhome/gtg/fix-localfile-tasks-storage into lp:gtg.
=== modified file 'GTG/backends/backend_localfile.py'
--- GTG/backends/backend_localfile.py	2013-02-25 08:12:02 +0000
+++ GTG/backends/backend_localfile.py	2013-10-08 12:57:20 +0000
@@ -35,6 +35,17 @@
 # Ignore all other elements but this one
 TASK_NODE = "task"
 
+STORAGE_FILENAME = 'gtg_tasks.xml'
+
+
+def get_tasks_filename():
+    '''Get the tasks storage filename
+
+    According to the description of localfile Backend, tasks are stored in
+    $XDG_DATA_DIR.
+    '''
+    return os.path.join(CoreConfig().get_data_dir(), STORAGE_FILENAME)
+
 
 class Backend(GenericBackend):
     """
@@ -71,8 +82,9 @@
     _static_parameters = {
         "path": {
             GenericBackend.PARAM_TYPE: GenericBackend.TYPE_STRING,
-            GenericBackend.PARAM_DEFAULT_VALUE:
-            "gtg_tasks.xml"}}
+            GenericBackend.PARAM_DEFAULT_VALUE: get_tasks_filename(),
+        }
+    }
 
     def __init__(self, parameters):
         """


Follow ups