← Back to team overview

gtg team mailing list archive

[Merge] lp:~thibaultfevry/gtg/code_cleanup into lp:gtg

 

Thibault Févry has proposed merging lp:~thibaultfevry/gtg/code_cleanup into lp:gtg.

Requested reviews:
  Gtg developers (gtg)

For more details, see:
https://code.launchpad.net/~thibaultfevry/gtg/code_cleanup/+merge/82211

These changes are basically just to comply with pep8 in all GTG/core files (with exceptions for some errors), to try to keep a consistent coding style. Merge is marked as experimental, but there shouldn't be any problem, unless an unwanted mistake.

 This does not change anything else than pep8 errors and warnings, I plan to do more little code cleanups that remove unused code or make the code more pythonish, but this one is just for pep8.
-- 
https://code.launchpad.net/~thibaultfevry/gtg/code_cleanup/+merge/82211
Your team Gtg developers is requested to review the proposed merge of lp:~thibaultfevry/gtg/code_cleanup into lp:gtg.
=== modified file 'GTG/core/__init__.py'
--- GTG/core/__init__.py	2011-09-25 15:21:46 +0000
+++ GTG/core/__init__.py	2011-11-14 19:15:30 +0000
@@ -51,24 +51,24 @@
 
 DEFAULTS = {
 'browser': {
-            'bg_color_enable' : False,
-            "contents_preview_enable" : False,
-            'tag_pane' : False,
+            'bg_color_enable': False,
+            "contents_preview_enable": False,
+            'tag_pane': False,
             "sidebar_width": 120,
-            "closed_task_pane" : False,
-            'bottom_pane_position' : 300,
-            'toolbar' : True,
-            'quick_add' : True,
+            "closed_task_pane": False,
+            'bottom_pane_position': 300,
+            'toolbar': True,
+            'quick_add': True,
             "bg_color_enable": True,
-            'collapsed_tasks' : [],
-            'collapsed_tags' : [],
-            'view' : 'default',
+            'collapsed_tasks': [],
+            'collapsed_tags': [],
+            'view': 'default',
             "opened_tasks": [],
             'width': 400,
-            'height':400,
-            'x_pos':10,
-            'y_pos':10,
-            'tasklist_sort_column':5,
+            'height': 400,
+            'x_pos': 10,
+            'y_pos': 10,
+            'tasklist_sort_column': 5,
             'tasklist_sort_order': 1,
             }
 }
@@ -79,7 +79,7 @@
 #element of the ConfigObj directory)
 #
 #The goal of the SubConfig object is to handle default value and converting
-#String to Bool and Int when needed. 
+#String to Bool and Int when needed.
 #
 #Each GTG component using config should be ported to SubConfig and, for each
 #setting, a default value should be written in the DEFAULTS above.
@@ -87,39 +87,38 @@
 #Currently done : browser
 #Todo : editor, plugins
 class SubConfig():
-    def __init__(self,name,conf_dic):
+    def __init__(self, name, conf_dic):
         self.__name = name
         self.__conf = conf_dic
-        if DEFAULTS.has_key(name):
+        if name in DEFAULTS:
             self.__defaults = DEFAULTS[name]
         else:
             self.__defaults = {}
-        
+
     #This return the value of the setting (or the default one)
     #
     #If a default value exists and is a Int or a Bool, the returned
     #value is converted to that type.
-    def get(self,name):
-        if self.__conf.has_key(name):
+    def get(self, name):
+        if name in self.__conf:
             toreturn = self.__conf[name]
             #Converting to the good type
-            if self.__defaults.has_key(name):
+            if name in self.__defaults:
                 ntype = type(self.__defaults[name])
-                if ntype in (bool,int) and type(toreturn) == str:
+                if ntype in (bool, int) and type(toreturn) == str:
                     toreturn = eval(toreturn)
-        elif self.__defaults.has_key(name):
+        elif name in self.__defaults:
             toreturn = self.__defaults[name]
             self.__conf[name] = toreturn
         else:
-            print "Warning : no default conf value for %s in %s" %(name,self.__name)
+            print "Warning : no default conf value for %s in %s" % (name, self.__name)
             toreturn = None
-        return toreturn 
-    
-    def set(self,name,value):
+        return toreturn
+
+    def set(self, name, value):
         self.__conf[name] = str(value)
 
 
-
 class CoreConfig(Borg):
     #The projects and tasks are of course DATA !
     #We then use XDG_DATA for them
@@ -145,8 +144,8 @@
             self.data_dir = '/tmp/GTG_TESTS/data'
             self.conf_dir = '/tmp/GTG_TESTS/conf'
         else:
-            self.data_dir = os.path.join(xdg_data_home,'gtg/')
-            self.conf_dir = os.path.join(xdg_config_home,'gtg/')
+            self.data_dir = os.path.join(xdg_data_home, 'gtg/')
+            self.conf_dir = os.path.join(xdg_config_home, 'gtg/')
         if not os.path.exists(self.conf_dir):
             os.makedirs(self.conf_dir)
         if not os.path.exists(self.data_dir):
@@ -165,16 +164,16 @@
                             "cannot be read or written. Please check it")
         self.conf_dict = ConfigObj(self.conf_dir + self.CONF_FILE)
         self.task_conf_dict = ConfigObj(self.conf_dir + self.TASK_CONF_FILE)
-    
+
     def save(self):
         ''' Saves the configuration of CoreConfig '''
         self.conf_dict.write()
         self.task_conf_dict.write()
-        
-    def get_subconfig(self,name):
-        if not self.conf_dict.has_key(name):
+
+    def get_subconfig(self, name):
+        if not name in self.conf_dict:
             self.conf_dict[name] = {}
-        return SubConfig(name,self.conf_dict[name])
+        return SubConfig(name, self.conf_dict[name])
 
     def get_icons_directories(self):
         '''

=== modified file 'GTG/core/datastore.py'
--- GTG/core/datastore.py	2011-09-25 18:36:12 +0000
+++ GTG/core/datastore.py	2011-11-14 19:15:30 +0000
@@ -56,15 +56,14 @@
     Requester instead (which also sends signals as you issue commands).
     '''
 
-
-    def __init__(self,global_conf=CoreConfig()):
+    def __init__(self, global_conf=CoreConfig()):
         '''
         Initializes a DataStore object
         '''
         self.backends = {} #dictionary {backend_name_string: Backend instance}
         self.treefactory = TreeFactory()
         self.__tasks = self.treefactory.get_tasks_tree()
-        self.requester = requester.Requester(self,global_conf)
+        self.requester = requester.Requester(self, global_conf)
         self.tagfile = None
         self.__tagstore = self.treefactory.get_tags_tree(self.requester)
         self.added_tag = {}
@@ -102,7 +101,7 @@
                                                this datastore
         '''
         return self.requester
-        
+
     def get_tasks_tree(self):
         '''
         Helper function to get a Tree with all the tasks contained in this
@@ -111,24 +110,24 @@
         @returns GTG.core.tree.Tree: a task tree (the main one)
         '''
         return self.__tasks
-        
+
     ##########################################################################
     ### Tags functions
     ##########################################################################
-    
-    def new_tag(self,tagname):
+
+    def new_tag(self, tagname):
         """Create a new tag and return it or return the existing one
         with corresponding name"""
-        def adding_tag(tname,tag):
+        def adding_tag(tname, tag):
             if not self.__tagstore.has_node(tname):
-                p = {'tag':tname,'transparent':True}
-                self.__tasks.add_filter(tname,self.treefactory.tag_filter,parameters=p)
+                p = {'tag': tname, 'transparent': True}
+                self.__tasks.add_filter(tname, self.treefactory.tag_filter, parameters=p)
                 self.__tagstore.add_node(tag)
                 tag.set_save_callback(self.save)
                 self.added_tag.pop(tname)
                 Log.debug("********* tag added %s *******" % tname)
             else:
-                print "Warning: Trying to add tag %s multiple times" %tname
+                print "Warning: Trying to add tag %s multiple times" % tname
         #we create a new tag from a name
         tname = tagname.encode("UTF-8")
         #if tname not in self.tags:
@@ -136,18 +135,18 @@
             if tname not in self.added_tag:
                 tag = Tag(tname, req=self.requester)
                 self.added_tag[tname] = tag
-                adding_tag(tname,tag)
+                adding_tag(tname, tag)
             else:
                 #it means that we are in the process of adding the tag
                 tag = self.added_tag[tname]
         else:
-            raise IndexError('tag %s was already in the datastore' %tagname)
+            raise IndexError('tag %s was already in the datastore' % tagname)
         return tag
-        
-    def rename_tag(self,oldname,newname):
+
+    def rename_tag(self, oldname, newname):
         print "Tag renaming not implemented yet"
-    
-    def get_tag(self,tagname):
+
+    def get_tag(self, tagname):
         #The following is wrong, as we have special tags that do not start with
         # @. I'm leaving this here temporary to help in merging (as it will
         # probably generate a conflict). Remove at will after merging
@@ -158,11 +157,11 @@
             return self.__tagstore.get_node(tagname)
         else:
             return None
-            
+
     def load_tag_tree(self):
         # Loading tags
         tagfile = os.path.join(CoreConfig().get_data_dir(), TAG_XMLFILE)
-        doc, xmlstore = cleanxml.openxmlfile(tagfile,TAG_XMLROOT)
+        doc, xmlstore = cleanxml.openxmlfile(tagfile, TAG_XMLROOT)
         for t in xmlstore.childNodes:
             #We should only care about tag with a name beginning with "@"
             #Other are special tags
@@ -179,7 +178,7 @@
             if parent:
                 tag.set_parent(parent)
         self.tagfile = tagfile
-                
+
     def save_tagtree(self):
         if self.tagfile:
             doc, xmlroot = cleanxml.emptydoc(TAG_XMLROOT)
@@ -189,7 +188,7 @@
             #It saves space and allow the saved list growth to be controlled
             for tname in tags:
                 t = self.__tagstore.get_node(tname)
-                attr = t.get_all_attributes(butname = True, withparent = True)
+                attr = t.get_all_attributes(butname=True, withparent=True)
                 if "special" not in attr and len(attr) > 0:
                     tagname = t.get_name()
                     if not tagname in already_saved:
@@ -202,7 +201,6 @@
                                 t_xml.setAttribute(a, value)
                         xmlroot.appendChild(t_xml)
             cleanxml.savexml(self.tagfile, doc)
-    
 
     ##########################################################################
     ### Tasks functions
@@ -242,8 +240,8 @@
             #This is not an error: it is normal to request a task which
             #might not exist yet.
             return None
-        
-    def task_factory(self, tid, newtask = False):
+
+    def task_factory(self, tid, newtask=False):
         '''
         Instantiates the given task id as a Task object.
 
@@ -265,7 +263,7 @@
         task = self.task_factory(str(uuid.uuid4()), True)
         self.__tasks.add_node(task)
         return task
-        
+
     @synchronized
     def push_task(self, task):
         '''
@@ -281,7 +279,7 @@
             vip = False
             if task.get_status() == "Active":
                 vip = True
-            self.__tasks.add_node(task,high_priority=vip )
+            self.__tasks.add_node(task, high_priority=vip)
             task.set_loaded()
             if self.is_default_backend_loaded:
                 task.sync()
@@ -296,8 +294,8 @@
     ### Backends functions
     ##########################################################################
 
-    def get_all_backends(self, disabled = False):
-        """ 
+    def get_all_backends(self, disabled=False):
+        """
         returns list of all registered backends for this DataStore.
 
         @param disabled: If disabled is True, attaches also the list of disabled backends
@@ -343,15 +341,15 @@
                 return None
             #creating the TaskSource which will wrap the backend,
             # filtering the tasks that should hit the backend.
-            source = TaskSource(requester = self.requester,
-                                backend = backend,
-                                datastore = self.filtered_datastore)
+            source = TaskSource(requester=self.requester,
+                                backend=backend,
+                                datastore=self.filtered_datastore)
             self.backends[backend.get_id()] = source
             #we notify that a new backend is present
             self._backend_signals.backend_added(backend.get_id())
             #saving the backend in the correct dictionary (backends for enabled
             # backends, disabled_backends for the disabled ones)
-            #this is useful for retro-compatibility 
+            #this is useful for retro-compatibility
             if not GenericBackend.KEY_ENABLED in backend_dic:
                 source.set_parameter(GenericBackend.KEY_ENABLED, True)
             if not GenericBackend.KEY_DEFAULT_BACKEND in backend_dic:
@@ -359,7 +357,7 @@
             #if it's enabled, we initialize it
             if source.is_enabled() and \
                (self.is_default_backend_loaded or source.is_default()):
-                source.initialize(connect_signals = False)
+                source.initialize(connect_signals=False)
                 #Filling the backend
                 #Doing this at start is more efficient than
                 #after the GUI is launched
@@ -368,7 +366,7 @@
         else:
             Log.error("Tried to register a backend without a  pid")
 
-    def _activate_non_default_backends(self, sender = None):
+    def _activate_non_default_backends(self, sender=None):
         '''
         Non-default backends have to wait until the default loads before
         being  activated. This function is called after the first default
@@ -380,7 +378,6 @@
             Log.debug("spurious call")
             return
 
-
         self.is_default_backend_loaded = True
         for backend in self.backends.itervalues():
             if backend.is_enabled() and not backend.is_default():
@@ -402,8 +399,8 @@
             backend.start_get_tasks()
             self.flush_all_tasks(backend.get_id())
 
-        thread = threading.Thread(target = __backend_startup,
-                                          args = (self, backend))
+        thread = threading.Thread(target=__backend_startup,
+                                          args=(self, backend))
         thread.setDaemon(True)
         thread.start()
 
@@ -427,8 +424,8 @@
             if current_state == True and state == False:
                 #we disable the backend
                 #FIXME!!!
-                threading.Thread(target = backend.quit, \
-                                 kwargs = {'disable': True}).start()
+                threading.Thread(target=backend.quit, \
+                                 kwargs={'disable': True}).start()
             elif current_state == False and state == True:
                 if self.is_default_backend_loaded == True:
                     self._backend_startup(backend)
@@ -474,7 +471,7 @@
         identified with backend_id. If tasks need to be added or removed, it
         will be done here.
         It has to be run after the creation of a new backend (or an alteration
-        of its "attached tags"), so that the tasks which are already loaded in 
+        of its "attached tags"), so that the tasks which are already loaded in
         the Tree will be saved in the proper backends
 
         @param backend_id: a backend id
@@ -485,13 +482,13 @@
                 if self.please_quit:
                     break
                 backend.queue_set_task(task_id)
-        t = threading.Thread(target = _internal_flush_all_tasks)
+        t = threading.Thread(target=_internal_flush_all_tasks)
         t.start()
         self.backends[backend_id].start_get_tasks()
 
-    def save(self, quit = False):
+    def save(self, quit=False):
         '''
-        Saves the backends parameters. 
+        Saves the backends parameters.
 
         @param quit: If quit is true, backends are shut down
         '''
@@ -499,23 +496,23 @@
             self.start_get_tasks_thread.join()
         except Exception, e:
             pass
-        doc,xmlconfig = cleanxml.emptydoc("config")
+        doc, xmlconfig = cleanxml.emptydoc("config")
         #we ask all the backends to quit first.
         if quit:
             #we quit backends in parallel
             threads_dic = {}
             for b in self.get_all_backends():
-                thread = threading.Thread(target = b.quit)
+                thread = threading.Thread(target=b.quit)
                 threads_dic[b.get_id()] = thread
                 thread.start()
             for backend_id, thread in threads_dic.iteritems():
                 #after 20 seconds, we give up
                 thread.join(20)
                 if thread.isAlive():
-                    Log.error("The %s backend stalled while quitting", 
+                    Log.error("The %s backend stalled while quitting",
                               backend_id)
         #we save the parameters
-        for b in self.get_all_backends(disabled = True):
+        for b in self.get_all_backends(disabled=True):
             t_xml = doc.createElement("backend")
             for key, value in b.get_parameters().iteritems():
                 if key in ["backend", "xmlobject"]:
@@ -528,18 +525,18 @@
             #Saving all the projects at close
             xmlconfig.appendChild(t_xml)
         datafile = os.path.join(CoreConfig().get_data_dir(), CoreConfig.DATA_FILE)
-        cleanxml.savexml(datafile,doc,backup=True)
+        cleanxml.savexml(datafile, doc, backup=True)
         #Saving the tagstore
         self.save_tagtree()
-        
+
     def request_task_deletion(self, tid):
-        ''' 
+        '''
         This is a proxy function to request a task deletion from a backend
 
         @param tid: the tid of the task to remove
         '''
         self.requester.delete_task(tid)
-    
+
     def get_backend_mutex(self):
         '''
         Returns the mutex object used by backends to avoid modifying a task
@@ -550,14 +547,12 @@
         return self._backend_mutex
 
 
-
 class TaskSource():
     '''
     Transparent interface between the real backend and the DataStore.
     Is in charge of connecting and disconnecting to signals
     '''
 
-
     def __init__(self, requester, backend, datastore):
         """
         Instantiates a TaskSource object.
@@ -577,18 +572,18 @@
         if Log.is_debugging_mode():
             self.timer_timestep = 5
         else:
-            self.timer_timestep = 1 
+            self.timer_timestep = 1
         self.add_task_handle = None
         self.set_task_handle = None
         self.remove_task_handle = None
         self.to_set_timer = None
-        
+
     def start_get_tasks(self):
         ''''
         Maps the TaskSource to the backend and starts threading.
         '''
         self.start_get_tasks_thread = \
-             threading.Thread(target = self.__start_get_tasks)
+             threading.Thread(target=self.__start_get_tasks)
         self.start_get_tasks_thread.setDaemon(True)
         self.start_get_tasks_thread.start()
 
@@ -656,8 +651,8 @@
                 self.__try_launch_setting_thread()
         else:
             self.queue_remove_task(tid, path)
-            
-    def launch_setting_thread(self, bypass_please_quit = False):
+
+    def launch_setting_thread(self, bypass_please_quit=False):
         '''
         Operates the threads to set and remove tasks.
         Releases the lock when it is done.
@@ -688,7 +683,7 @@
             self.backend.queue_remove_task(tid)
         #we release the weak lock
         self.to_set_timer = None
-    
+
     def queue_remove_task(self, tid, path=None):
         '''
         Queues task to be removed.
@@ -710,7 +705,7 @@
             self.to_set_timer.setDaemon(True)
             self.to_set_timer.start()
 
-    def initialize(self, connect_signals = True):
+    def initialize(self, connect_signals=True):
         '''
         Initializes the backend and starts looking for signals.
 
@@ -764,9 +759,9 @@
             self.start_get_tasks_thread.join(3)
         except:
             pass
-        self.launch_setting_thread(bypass_please_quit = True)
+        self.launch_setting_thread(bypass_please_quit=True)
 
-    def quit(self, disable = False):
+    def quit(self, disable=False):
         '''
         Quits the backend and disconnect the signals
 
@@ -776,7 +771,7 @@
         self.please_quit = True
         self.sync()
         self.backend.quit(disable)
-    
+
     def __getattr__(self, attr):
         '''
         Delegates all the functions not defined here to the real backend
@@ -784,21 +779,19 @@
 
         @param attr: attribute to get
         '''
-        if attr in self.__dict__: 
+        if attr in self.__dict__:
             return self.__dict__[attr]
         else:
             return getattr(self.backend, attr)
 
 
-
 class FilteredDataStore(Borg):
-    ''' 
+    '''
     This class acts as an interface to the Datastore.
     It is used to hide most of the methods of the Datastore.
     The backends can safely use the remaining methods.
     '''
 
-
     def __init__(self, datastore):
         super(FilteredDataStore, self).__init__()
         self.datastore = datastore
@@ -817,4 +810,4 @@
         elif attr in ['get_all_tags']:
             return self.datastore.requester.get_all_tags
         else:
-            raise AttributeError("No attribute %s" %attr)
+            raise AttributeError("No attribute %s" % attr)

=== modified file 'GTG/core/firstrun_tasks.py'
--- GTG/core/firstrun_tasks.py	2011-10-08 21:47:12 +0000
+++ GTG/core/firstrun_tasks.py	2011-11-14 19:15:30 +0000
@@ -2,8 +2,9 @@
 from GTG.tools import cleanxml
 from GTG.tools.tags import extract_tags_from_text
 
+
 def populate():
-    doc,root = cleanxml.emptydoc("project")
+    doc, root = cleanxml.emptydoc("project")
 
     #Task 0@1: Getting started with GTG
     title1 = _("Getting started with GTG")
@@ -30,7 +31,7 @@
 Thank you for trying out GTG :-)""")
     t1 = addtask(doc, "0@1", title1, text1, ["1@1", "2@1", "3@1", "4@1", "5@1", "6@1"])
     root.appendChild(t1)
-    
+
     #Task 1@1: Learn to use subtasks
     title2 = _("Learn how to use subtasks")
     text2 = _("""In the task description (this window), if you begin a line with "-", it will be considered as a "subtask", something that needs to be done in order to accomplish your task. Just try to write "- test subtask" on the next line and press enter.
@@ -44,7 +45,7 @@
 Also, marking a parent as done will mark all the subtasks as done.""")
     t2 = addtask(doc, "1@1", title2, text2, [])
     root.appendChild(t2)
-    
+
     #Task 2@1: Learn to use tags
     title3 = _("Learn how to use tags")
     text3 = _("""A tag is a simple word that begins with "@".
@@ -62,7 +63,7 @@
 A new tag is only added to the current task. There's no recursion and the tag is not applied to subtasks. But when you create a new subtask, this subtask will inherit the tags of its parent as a good primary default (it will also be the case if you add a tag to a parent just after creating a subtask). Of course, you can modify at any time the tags of this particular subtask. It will never be changed by the parent.""")
     t3 = addtask(doc, "2@1", title3, text3, [])
     root.appendChild(t3)
-    
+
     #Task 3@1: Using the Workview
     title4 = _("Learn how to use the Workview")
     text4 = _("""If you press the "Workview" button, only actionable tasks will be displayed.
@@ -78,14 +79,14 @@
 If you use tags, you can right click on a tag in the sidebar and choose to hide tasks assigned to this particular tag in the workview. It's very useful if you have a tag like "someday" that you use for tasks you would like to do but are not particularly urgent.""")
     t4 = addtask(doc, "3@1", title4, text4, [])
     root.appendChild(t4)
-    
+
     #Task 5@1: Plugins
     title5 = _("Learn how to use Plugins")
     text5 = _("""GTG has the ability to add plugins to extend it's core functionality.
 
 Some examples of the current plugins are Syncing with Remember the Milk and Evolution, Tomboy/Gnote integration and Geolocalized Tasks.
 You can find the Plugin Manager by selecting Edit in the Menu Bar, then clicking Preferences. You will then see a tab labeled Plugins.""")
-    
+
     t5 = addtask(doc, "4@1", title5, text5, [])
     root.appendChild(t5)
 
@@ -99,10 +100,10 @@
 We need you to make this software better. Any contribution, any idea is welcome.
 
 If you have some trouble with GTG, we might be able to help you or to solve your problem really quickly.""")
-    
+
     t6 = addtask(doc, "5@1", title6, text6, [])
     root.appendChild(t6)
-    
+
     #Task 6@1: Learn how to use the QuickAdd Entry
     title7 = _("Learn how to use the QuickAdd Entry")
     text7 = _("""The quickadd entry is the quickest way to create a new task. You can show or hide it in the View menu.
@@ -114,8 +115,8 @@
 tags:tag1,tag2,tag3
  - This way you can apply as many tags as you wish using comma as separator
 
-due:date 
-defer:date 
+due:date
+defer:date
  - This way you can apply a due date or a defer date. date can be yyyy-mm-dd (for example 2009-04-01) or yyyymmdd (20090401) or mmdd (0401, in this case the year is implicitly the current one) or today or tomorrow or a weekday name (due:monday means due next Monday)
 
 Attributes which are added in this way apply but do not appear in the title.
@@ -126,7 +127,7 @@
     root.appendChild(t7)
 
     return doc
-    
+
 
 def addtask(doc, ze_id, title, text, childs):
     t_xml = doc.createElement("task")

=== modified file 'GTG/core/plugins/__init__.py'
--- GTG/core/plugins/__init__.py	2010-02-15 21:37:57 +0000
+++ GTG/core/plugins/__init__.py	2011-11-14 19:15:30 +0000
@@ -25,21 +25,22 @@
 
 from GTG import _
 
+
 class GnomeConfig:
     current_rep = os.path.dirname(os.path.abspath(__file__))
-    GLADE_FILE    = os.path.join(current_rep,"pluginmanager.glade")
-    
+    GLADE_FILE = os.path.join(current_rep, "pluginmanager.glade")
+
     CANLOAD = _("Everything necessary to run this plugin is available.")
     CANNOTLOAD = _("The plugin can not be loaded")
     miss1 = _("Some python modules are missing")
     miss2 = _("Please install the following python modules:")
-    MODULEMISSING = "%s \n%s" %(miss1,miss2)
+    MODULEMISSING = "%s \n%s" % (miss1, miss2)
     dmiss1 = _("Some remote dbus objects are missing.")
     dmiss2 = _("Please start the following applications:")
-    DBUSMISSING = "%s \n%s" %(dmiss1,dmiss2)
+    DBUSMISSING = "%s \n%s" % (dmiss1, dmiss2)
     bmiss1 = _("Some modules and remote dbus objects are missing.")
     bmiss2 = _("Please install or start the following components:")
-    MODULANDDBUS = "%s \n%s" %(bmiss1,bmiss2)
+    MODULANDDBUS = "%s \n%s" % (bmiss1, bmiss2)
     umiss1 = _("Unknown error while loading the plugin.")
     umiss2 = _("Very helpful message, isn't it? Please report a bug.")
-    UNKNOWN = "%s \n%s" %(umiss1,umiss2)
+    UNKNOWN = "%s \n%s" % (umiss1, umiss2)

=== modified file 'GTG/core/plugins/api.py'
--- GTG/core/plugins/api.py	2010-09-14 14:57:54 +0000
+++ GTG/core/plugins/api.py	2011-11-14 19:15:30 +0000
@@ -24,7 +24,6 @@
 from GTG.tools.logger  import Log
 
 
-
 class PluginAPI:
     """The plugin engine's API.
 
@@ -39,7 +38,7 @@
     def __init__(self,
                  requester,
                  view_manager,
-                 taskeditor = None):
+                 taskeditor=None):
         """
         Construct a PluginAPI object.
 
@@ -102,22 +101,22 @@
 #=== Changing the UI =========================================================
 
     def add_menu_item(self, item):
-        """Adds a menu entry to the Plugin Menu of the Main Window 
+        """Adds a menu entry to the Plugin Menu of the Main Window
         (task browser).
 
-        @param item: The gtk.MenuItem that is going to be added.  
+        @param item: The gtk.MenuItem that is going to be added.
         """
         widget = self.__builder.get_object('plugin_mi')
         widget.get_submenu().append(item)
         widget.show_all()
 
     def remove_menu_item(self, item):
-        """Removes a menu entry from the Plugin Menu of the Main Window 
+        """Removes a menu entry from the Plugin Menu of the Main Window
         (task browser).
 
         @param item: The gtk.MenuItem that is going to be removed.
-        @return: Returns C{True} if the operation has sucess or c{False} if it 
-        fails.  
+        @return: Returns C{True} if the operation has sucess or c{False} if it
+        fails.
         """
         menu = self.__builder.get_object('plugin_mi')
         submenu = menu.get_submenu()
@@ -132,7 +131,7 @@
         """Adds a button to the task browser's toolbar or the task editor
         toolbar, depending on which plugin api it's being used.
 
-        @param widget: The gtk.ToolButton that is going to be added to the 
+        @param widget: The gtk.ToolButton that is going to be added to the
         toolbar.
         """
         #-1 means "append to the end"
@@ -145,12 +144,12 @@
         try:
             self.__toolbar.remove(widget)
         except Exception, e:
-            print "Error removing the toolbar item in the TaskEditor: %s" %e
+            print "Error removing the toolbar item in the TaskEditor: %s" % e
 
     def add_widget_to_taskeditor(self, widget):
         """Adds a widget to the bottom of the task editor dialog
 
-        @param widget: The gtk.Widget that is going to be added. 
+        @param widget: The gtk.Widget that is going to be added.
         """
         vbox = self.__builder.get_object('vbox4')
         if vbox:
@@ -163,7 +162,7 @@
         else:
             return None
 
-    def remove_widget_from_taskeditor(self,widg_id):
+    def remove_widget_from_taskeditor(self, widg_id):
         """Remove a widget from the bottom of the task editor dialog
 
         @param widget: The gtk.Widget that is going to be removed
@@ -175,12 +174,12 @@
                     wi.remove(self.taskwidget_widg.pop(widg_id))
             except Exception, e:
                 Log.debug("Error removing the toolbar item in the TaskEditor:"
-                          "%s" %e)
+                          "%s" % e)
 
 #=== file saving/loading ======================================================
 
     def load_configuration_object(self, plugin_name, filename, \
-                                  basedir = xdg_config_home):
+                                  basedir=xdg_config_home):
         dirname = os.path.join(basedir, 'gtg/plugins', plugin_name)
         path = os.path.join(dirname, filename)
         if os.path.isdir(dirname):
@@ -195,9 +194,8 @@
             os.makedirs(dirname)
 
     def save_configuration_object(self, plugin_name, filename, item, \
-                                 basedir = xdg_config_home):
+                                 basedir=xdg_config_home):
         dirname = os.path.join(basedir, 'gtg/plugins', plugin_name)
         path = os.path.join(dirname, filename)
         with open(path, 'wb') as file:
-             pickle.dump(item, file)
-
+            pickle.dump(item, file)

=== modified file 'GTG/core/plugins/engine.py'
--- GTG/core/plugins/engine.py	2010-09-09 19:18:21 +0000
+++ GTG/core/plugins/engine.py	2011-11-14 19:15:30 +0000
@@ -26,11 +26,9 @@
 from GTG.tools.borg import Borg
 
 
-
 class Plugin(object):
     """A class to represent a plugin."""
 
-
     # A reference to an instance of the plugin class
     instance = None
     # True if the plugin has been enabled by the user.
@@ -141,14 +139,12 @@
             self._check_dbus_depends()
 
 
-
 class PluginEngine(Borg):
     """
     A class to manage plugins. Only one can exist.
     """
 
-
-    def __init__(self, plugin_path = None):
+    def __init__(self, plugin_path=None):
         """Initialize the plugin engine.
         """
         super(PluginEngine, self).__init__()
@@ -173,7 +169,7 @@
     def get_plugin(self, module_name):
         return self.plugins[module_name]
 
-    def get_plugins(self, kind_of_plugins = "all"):
+    def get_plugins(self, kind_of_plugins="all"):
         """
         Returns a list of plugins
         filtering only a kind of plugin
@@ -186,6 +182,7 @@
         all_plugins = self.plugins.itervalues()
         if kind_of_plugins == "all":
             return all_plugins
+
         def filter_fun(plugin):
             return (kind_of_plugins == "active"   and plugin.active) or \
                    (kind_of_plugins == "inactive" and not plugin.active) or \
@@ -288,4 +285,3 @@
         for plugin in self.get_plugins():
             if check_all or plugin.error:
                 plugin.reload(self.plugin_path)
-

=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py	2011-09-25 13:17:30 +0000
+++ GTG/core/requester.py	2011-11-14 19:15:30 +0000
@@ -27,6 +27,7 @@
 from GTG.core.tagstore     import Tag
 from GTG.tools.logger      import Log
 
+
 class Requester(gobject.GObject):
     """A view on a GTG datastore.
 
@@ -49,13 +50,13 @@
               'tag-path-deleted' : __string_signal__, \
               'tag-modified'     : __string_signal__}
 
-    def __init__(self, datastore,global_conf):
+    def __init__(self, datastore, global_conf):
         """Construct a L{Requester}."""
         gobject.GObject.__init__(self)
         self.ds = datastore
         self.__config = global_conf
         self.__basetree = self.ds.get_tasks_tree()
-        
+
         #TODO build filters here
         self.counter_call = 0
 
@@ -65,38 +66,37 @@
     def _task_loaded(self, tid):
         gobject.idle_add(self.emit, "task-added", tid)
 
-        
     ############ Tasks Tree ######################
     # By default, we return the task tree of the main window
-    def get_tasks_tree(self,name='active',refresh=True):
-        return self.__basetree.get_viewtree(name=name,refresh=refresh)
+    def get_tasks_tree(self, name='active', refresh=True):
+        return self.__basetree.get_viewtree(name=name, refresh=refresh)
 
     def get_main_view(self):
         return self.__basetree.get_main_view()
-        
+
     # This is a FilteredTree that you have to handle yourself.
     # You can apply/unapply filters on it as you wish.
-#    def get_custom_tasks_tree(self,name=None,refresh=True):
-#        return self.__basetree.get_viewtree(name=name,refresh=refresh)
-        
-    def is_displayed(self,task):
+#    def get_custom_tasks_tree(self, name=None, refresh=True):
+#        return self.__basetree.get_viewtree(name=name, refresh=refresh)
+
+    def is_displayed(self, task):
         return self.__basetree.get_viewtree(name='active').is_displayed(task)
 
     ######### Filters bank #######################
     # List, by name, all available filters
     def list_filters(self):
         return self.__basetree.list_filters()
-    
+
     # Add a filter to the filter bank
     # Return True if the filter was added
     # Return False if the filter_name was already in the bank
-    def add_filter(self,filter_name,filter_func):
-        return self.__basetree.add_filter(filter_name,filter_func)
-        
+    def add_filter(self, filter_name, filter_func):
+        return self.__basetree.add_filter(filter_name, filter_func)
+
     # Remove a filter from the bank.
     # Only custom filters that were added here can be removed
     # Return False if the filter was not removed
-    def remove_filter(self,filter_name):
+    def remove_filter(self, filter_name):
         return self.__basetree.remove_filter(filter_name)
 
     ############## Tasks ##########################
@@ -137,7 +137,7 @@
         self._task_loaded(task.get_id())
         return task
 
-    def delete_task(self, tid,recursive=True):
+    def delete_task(self, tid, recursive=True):
         """Delete the task 'tid' and, by default, delete recursively
         all the childrens.
 
@@ -151,7 +151,7 @@
         if task:
             for tag in task.get_tags():
                 self.emit('tag-modified', tag.get_name())
-        return self.__basetree.del_node(tid,recursive=recursive)
+        return self.__basetree.del_node(tid, recursive=recursive)
 
     ############### Tags ##########################
     ###############################################
@@ -184,7 +184,7 @@
         #FIXME: let's use another view instead of the activetags one
         view = self.ds.get_tagstore().get_viewtree(name='activetags')
         l = view.get_all_nodes()
-        l.sort(cmp=lambda x, y: cmp(x.lower(),y.lower()))
+        l.sort(cmp=lambda x, y: cmp(x.lower(), y.lower()))
         return l
 
     def get_all_tags(self):
@@ -194,7 +194,7 @@
     ############## Backends #######################
     ###############################################
 
-    def get_all_backends(self, disabled = False):
+    def get_all_backends(self, disabled=False):
         return self.ds.get_all_backends(disabled)
 
     def register_backend(self, dic):
@@ -217,14 +217,14 @@
 
     def save_datastore(self):
         return self.ds.save()
-        
+
     ############## Config ############################
     ##################################################
     def get_global_config(self):
         return self.__config
-        
-    def get_config(self,name):
+
+    def get_config(self, name):
         return self.__config.get_subconfig(name)
-    
+
     def save_config(self):
         self.__config.save()

=== modified file 'GTG/core/tagstore.py'
--- GTG/core/tagstore.py	2011-09-25 16:23:31 +0000
+++ GTG/core/tagstore.py	2011-11-14 19:15:30 +0000
@@ -38,6 +38,7 @@
 
 #TODO: rename this file to tag.py
 
+
 class Tag(TreeNode):
     """A short name that can be applied to L{Task}s.
 
@@ -62,20 +63,21 @@
         self._save = None
         self._tasks_count = 0
         #list of tasks associated with this tag
-        
+
     #overiding some functions to not allow dnd of special tags
-    def add_parent(self,parent_id):
+    def add_parent(self, parent_id):
         if not self.is_special() and not self.req.get_tag(parent_id).is_special():
-            TreeNode.add_parent(self,parent_id) 
-    def add_child(self,child_id):
+            TreeNode.add_parent(self, parent_id)
+
+    def add_child(self, child_id):
         if not self.is_special() and not self.req.get_tag(child_id).is_special():
-            TreeNode.add_child(self,child_id)
+            TreeNode.add_child(self, child_id)
 
     def get_name(self):
         """Return the name of the tag."""
         return self.get_attribute("name")
 
-    def set_save_callback(self,save):
+    def set_save_callback(self, save):
         self._save = save
 
     def set_attribute(self, att_name, att_value):
@@ -115,26 +117,26 @@
             if self.has_parent():
                 parents_id = self.get_parents()
                 if len(parents_id) > 0:
-                    to_return = reduce(lambda a,b: "%s,%s" % (a, b), parents_id)
+                    to_return = reduce(lambda a, b: "%s,%s" % (a, b), parents_id)
         elif att_name == 'label':
-            to_return = self._attributes.get(att_name,self.get_id())
+            to_return = self._attributes.get(att_name, self.get_id())
         else:
             to_return = self._attributes.get(att_name, None)
         return to_return
-        
+
     def del_attribute(self, att_name):
         """Deletes the attribute C{att_name}.
         """
         if not att_name in self._attributes:
             return
-        elif att_name in ['name','parent']:
+        elif att_name in ['name', 'parent']:
             return
         else:
             del self._attributes[att_name]
         if self._save:
             self._save()
 
-    def get_all_attributes(self, butname=False, withparent = False):
+    def get_all_attributes(self, butname=False, withparent=False):
         """Return a list of all attribute names.
 
         @param butname: If True, exclude C{name} from the list of attribute
@@ -150,37 +152,37 @@
                 attributes.append("parent")
         return attributes
 
-    ### TASK relation ####      
-       
+    ### TASK relation ####
+
     def get_active_tasks_count(self):
         count = self.__get_count()
         return count
-        
+
     def get_total_tasks_count(self):
         return self.__get_count()
-        
-    def __get_count(self,tasktree=None):
+
+    def __get_count(self, tasktree=None):
         if not tasktree:
             tasktree = self.req.get_tasks_tree()
         sp_id = self.get_attribute("special")
         if sp_id == "all":
             toreturn = tasktree.get_n_nodes(\
-                    withfilters=['active'],include_transparent=False)
+                    withfilters=['active'], include_transparent=False)
         elif sp_id == "notag":
             toreturn = tasktree.get_n_nodes(\
-                            withfilters=['notag'],include_transparent=False)
-        elif sp_id == "sep" :
+                            withfilters=['notag'], include_transparent=False)
+        elif sp_id == "sep":
             toreturn = 0
         else:
             tname = self.get_name()
             toreturn = tasktree.get_n_nodes(\
-                                withfilters=[tname],include_transparent=False)
+                                withfilters=[tname], include_transparent=False)
         return toreturn
-        
+
     #is it useful to keep the tag in the tagstore.
     #if no attributes and no tasks, it is not useful.
     def is_removable(self):
-        attr = self.get_all_attributes(butname = True, withparent = True)
+        attr = self.get_all_attributes(butname=True, withparent=True)
         return (len(attr) <= 0 and not self.is_used())
 
     def is_special(self):

=== modified file 'GTG/core/task.py'
--- GTG/core/task.py	2011-08-17 09:57:00 +0000
+++ GTG/core/task.py	2011-11-14 19:15:30 +0000
@@ -73,13 +73,13 @@
         #Should not be necessary with the new backends
 #        if self.loaded:
 #            self.req._task_loaded(self.tid)
-        self.attributes={}
+        self.attributes = {}
         self._modified_update()
 
     def is_loaded(self):
         return self.loaded
 
-    def set_loaded(self,signal=True):
+    def set_loaded(self, signal=True):
         #avoid doing it multiple times
         if not self.loaded:
             self.loaded = True
@@ -143,17 +143,17 @@
             return True
         else:
             return False
-            
+
     #TODO : should we merge this function with set_title ?
-    def set_complex_title(self,text,tags=[]):
+    def set_complex_title(self, text, tags=[]):
         if tags:
             assert(isinstance(tags[0], str))
         due_date = no_date
         defer_date = no_date
         if text:
-            
+
             # Get tags in the title
-            #NOTE: the ?: tells regexp that the first one is 
+            #NOTE: the ?: tells regexp that the first one is
             # a non-capturing group, so it must not be returned
             # to findall. http://www.amk.ca/python/howto/regex/regex.html
             # ~~~~Invernizzi
@@ -168,8 +168,8 @@
                 if attribute.lower() in ["tags", "tag"] or \
                    attribute.lower() in [_("tags"), _("tag")]:
                     for tag in args.split(","):
-                        if not tag.startswith("@") :
-                            tag = "@"+tag
+                        if not tag.startswith("@"):
+                            tag = "@" + tag
                         tags.append(tag)
                 elif attribute.lower() == "defer" or \
                      attribute.lower() == _("defer"):
@@ -262,7 +262,7 @@
             pardate = self.req.get_task(par).get_due_date()
             if pardate and zedate > pardate:
                 zedate = pardate
-        
+
         return zedate
 
     def set_start_date(self, fulldate):
@@ -277,7 +277,7 @@
         assert(isinstance(fulldate, Date))
         self.closed_date = fulldate
         self.sync()
-        
+
     def get_closed_date(self):
         return self.closed_date
 
@@ -286,7 +286,7 @@
         if due_date == no_date:
             return None
         return due_date.days_left()
-    
+
     def get_days_late(self):
         due_date = self.get_due_date()
         if due_date == no_date:
@@ -343,8 +343,8 @@
         if element:
             for n in element.childNodes:
                 if n.nodeType == n.ELEMENT_NODE:
-                    if strip_subtasks and n.tagName=='subtask':
-                        if txt[-2:]=='→ ':
+                    if strip_subtasks and n.tagNameu == 'subtask':
+                        if txt[-2:] == '→ ':
                             txt = txt[:-2]
                     else:
                         txt += self.__strip_content(n, strip_subtasks)
@@ -357,10 +357,10 @@
         if texte != "<content/>":
             #defensive programmation to filter bad formatted tasks
             if not texte.startswith("<content>"):
-                texte = cgi.escape(texte, quote = True)
-                texte = "<content>%s" %texte
+                texte = cgi.escape(texte, quote=True)
+                texte = "<content>%s" % texte
             if not texte.endswith("</content>"):
-                texte = "%s</content>" %texte
+                texte = "%s</content>" % texte
             self.content = str(texte)
         else:
             self.content = ''
@@ -371,20 +371,20 @@
         """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(newtask=True)
         #we use the inherited childrens
         self.add_child(subt.get_id())
         return subt
-        
+
     def add_child(self, tid):
         """Add a subtask to this task
 
         @param child: the added task
         """
-        Log.debug("adding child %s to task %s" %(tid, self.get_id()))
+        Log.debug("adding child %s to task %s" % (tid, self.get_id()))
         self.can_be_deleted = False
         #the core of the method is in the TreeNode object
-        TreeNode.add_child(self,tid)
+        TreeNode.add_child(self, tid)
         #now we set inherited attributes only if it's a new task
         child = self.req.get_task(tid)
         if child and child.can_be_deleted:
@@ -393,8 +393,8 @@
                 child.add_tag(t.get_name())
         self.sync()
         return True
-            
-    def remove_child(self,tid):
+
+    def remove_child(self, tid):
         """Removed a subtask from the task.
 
         @param tid: the ID of the task to remove
@@ -407,8 +407,7 @@
             return True
         else:
             return False
-            
-            
+
     #FIXME: remove this function and use liblarch instead.
     def get_subtasks(self):
         tree = self.get_tree()
@@ -462,7 +461,7 @@
         val = unicode(str(att_value), "UTF-8")
         self.attributes[(namespace, att_name)] = val
         self.sync()
-    
+
     def get_attribute(self, att_name, namespace=""):
         """Get the attribute C{att_name}.
 
@@ -479,13 +478,12 @@
             return True
         else:
             return False
-          
-#   the following is not currently needed  
+
+#   the following is not currently needed
 #    def modified(self):
 #        TreeNode.modified(self)
 #        for t in self.get_tags():
 #            gobject.idle_add(t.modified)
-        
 
     def _modified_update(self):
         '''
@@ -508,7 +506,7 @@
                 tag = self.req.new_tag(tname)
             l.append(tag)
         return l
-        
+
     def rename_tag(self, old, new):
         eold = saxutils.escape(saxutils.unescape(old))
         enew = saxutils.escape(saxutils.unescape(new))
@@ -535,25 +533,25 @@
                 for child in self.get_subtasks():
                     if child.can_be_deleted:
                         child.add_tag(t)
-            
+
                 tag = self.req.get_tag(t)
                 if not tag:
                     tag = self.req.new_tag(t)
                 tag.modified()
             return True
-    
+
     def add_tag(self, tagname):
         "Add a tag to the task and insert '@tag' into the task's content"
 #        print "add tag %s to task %s" %(tagname,self.get_title())
         if self.tag_added(tagname):
             c = self.content
-            
+
             #strip <content>...</content> tags
             if c.startswith('<content>'):
                 c = c[len('<content>'):]
             if c.endswith('</content>'):
                 c = c[:-len('</content>')]
-            
+
             if not c:
                 # don't need a separator if it's the only text
                 sep = ''
@@ -563,7 +561,7 @@
             else:
                 # other text at the beginning, so put the tag on its own line
                 sep = '\n\n'
-            
+
             self.content = "<content><tag>%s</tag>%s%s</content>" % (
                 tagname, sep, c)
             #we modify the task internal state, thus we have to call for a sync
@@ -582,7 +580,7 @@
         if modified:
             tag = self.req.get_tag(tagname)
             tag.modified()
-    
+
     def set_only_these_tags(self, tags_list):
         '''
         Given a list of strings representing tags, it makes sure that
@@ -596,18 +594,17 @@
         for tag in tags_list:
             self.add_tag(tag)
 
-    def _strip_tag(self, text, tagname,newtag=''):
+    def _strip_tag(self, text, tagname, newtag=''):
         return (text
-                    .replace('<tag>%s</tag>\n\n'%(tagname), newtag) #trail \n
-                    .replace('<tag>%s</tag>, '%(tagname), newtag) #trail comma
-                    .replace('<tag>%s</tag>'%(tagname), newtag)
+                    .replace('<tag>%s</tag>\n\n' % (tagname), newtag) #trail \n
+                    .replace('<tag>%s</tag>, ' % (tagname), newtag) #trail comma
+                    .replace('<tag>%s</tag>' % (tagname), newtag)
                     #in case XML is missing (bug #504899)
-                    .replace('%s\n\n'%(tagname), newtag) 
-                    .replace('%s, '%(tagname), newtag) 
+                    .replace('%s\n\n' % (tagname), newtag)
+                    .replace('%s, ' % (tagname), newtag)
                     #don't forget a space a the end
-                    .replace('%s '%(tagname), newtag)
+                    .replace('%s ' % (tagname), newtag)
                )
-     
 
     #tag_list is a list of tags names
     #return true if at least one of the list is in the task
@@ -623,7 +620,7 @@
                     if not toreturn:
                         toreturn = children_tag(tagc_name)
             return toreturn
-                
+
         #We want to see if the task has no tags
         toreturn = False
         if notag_only:
@@ -635,7 +632,7 @@
         elif tag_list:
             for tagname in tag_list:
                 if not toreturn:
-                    toreturn = children_tag(tagname) 
+                    toreturn = children_tag(tagname)
         else:
             #Well, if we don't filter on tags or notag, it's true, of course
             toreturn = True
@@ -658,5 +655,5 @@
         s = s + "Title:  " + self.title + "\n"
         s = s + "Id:     " + self.tid + "\n"
         s = s + "Status: " + self.status + "\n"
-        s = s + "Tags:   "  + str(self.tags)
+        s = s + "Tags:   " + str(self.tags)
         return s

=== modified file 'GTG/core/treefactory.py'
--- GTG/core/treefactory.py	2011-08-12 13:11:11 +0000
+++ GTG/core/treefactory.py	2011-11-14 19:15:30 +0000
@@ -27,6 +27,7 @@
 from GTG.core.tagstore           import Tag
 from GTG.core         import CoreConfig
 
+
 class TreeFactory:
 
     def __init__(self):
@@ -35,7 +36,7 @@
         self.tagtree = None
 
     def get_tasks_tree(self):
-        '''This create a liblarch tree suitable for tasks, 
+        '''This create a liblarch tree suitable for tasks,
         including default filters
         For tags, filter are dynamically created at Tag insertion.
         '''
@@ -51,104 +52,101 @@
           'workstarted': [self.workstarted],
           'worktostart': [self.worktostart],
           'worklate': [self.worklate],
-          'no_disabled_tag': [self.no_disabled_tag,{'transparent': True}],
+          'no_disabled_tag': [self.no_disabled_tag, {'transparent': True}],
           }
-          
+
         for f in f_dic:
             filt = f_dic[f]
             if len(filt) > 1:
                 param = filt[1]
             else:
                 param = None
-            tasktree.add_filter(f,filt[0],param)
+            tasktree.add_filter(f, filt[0], param)
         self.tasktree = tasktree
         return tasktree
-    
-    
-    def get_tags_tree(self,req):
+
+    def get_tags_tree(self, req):
         '''This create a liblarch tree suitable for tags,
         including the all_tags_tag and notag_tag.
         '''
         tagtree = Tree()
-        
+
         ### building the initial tags
         # Build the "all tasks tag"
         alltag = Tag(CoreConfig.ALLTASKS_TAG, req=req)
-        alltag.set_attribute("special","all")
-        alltag.set_attribute("label","<span weight='bold'>%s</span>"\
+        alltag.set_attribute("special", "all")
+        alltag.set_attribute("label", "<span weight='bold'>%s</span>"\
                                              % _("All tasks"))
-        alltag.set_attribute("icon","gtg-tags-all")
-        alltag.set_attribute("order",0)
+        alltag.set_attribute("icon", "gtg-tags-all")
+        alltag.set_attribute("order", 0)
         tagtree.add_node(alltag)
-        p = {'transparent':True}
+        p = {'transparent': True}
         self.tasktree.add_filter(CoreConfig.ALLTASKS_TAG,\
-                                    self.alltag,parameters=p)
+                                    self.alltag, parameters=p)
         # Build the "without tag tag"
-        notag_tag = Tag(CoreConfig.NOTAG_TAG,req=req)
-        notag_tag.set_attribute("special","notag")
-        notag_tag.set_attribute("label","<span weight='bold'>%s</span>"\
+        notag_tag = Tag(CoreConfig.NOTAG_TAG, req=req)
+        notag_tag.set_attribute("special", "notag")
+        notag_tag.set_attribute("label", "<span weight='bold'>%s</span>"\
                                              % _("Tasks with no tags"))
-        notag_tag.set_attribute("icon","gtg-tags-none")
-        notag_tag.set_attribute("order",1)
+        notag_tag.set_attribute("icon", "gtg-tags-none")
+        notag_tag.set_attribute("order", 1)
         tagtree.add_node(notag_tag)
-        p = {'transparent':True}
+        p = {'transparent': True}
         self.tasktree.add_filter(CoreConfig.NOTAG_TAG,\
-                                    self.notag,parameters=p)
+                                    self.notag, parameters=p)
         # Build the separator
-        sep_tag = Tag(CoreConfig.SEP_TAG,req=req)
-        sep_tag.set_attribute("special","sep")
-        sep_tag.set_attribute("order",2)
+        sep_tag = Tag(CoreConfig.SEP_TAG, req=req)
+        sep_tag.set_attribute("special", "sep")
+        sep_tag.set_attribute("order", 2)
         tagtree.add_node(sep_tag)
-        
-        
-        #### Filters 
-        tagtree.add_filter('activetag',self.actively_used_tag)
-        tagtree.add_filter('usedtag',self.used_tag)
-        
-        activeview = tagtree.get_viewtree(name='activetags',refresh=False)
+
+        #### Filters
+        tagtree.add_filter('activetag', self.actively_used_tag)
+        tagtree.add_filter('usedtag', self.used_tag)
+
+        activeview = tagtree.get_viewtree(name='activetags', refresh=False)
         activeview.apply_filter('activetag')
-        
+
         #This view doesn't seem to be used. So it's not useful to build it now
 #        usedview = tagtree.get_viewtree(name='usedtags',refresh=False)
 #        usedview.apply_filter('usedtag')
-        
+
         self.tagtree = tagtree
         self.tagtree_loaded = True
         return tagtree
-    
+
     ################# Tag Filters ##########################################
-    
+
     #filter to display only tags with active tasks
-    def actively_used_tag(self,node,parameters=None):
+    def actively_used_tag(self, node, parameters=None):
         toreturn = node.is_actively_used()
         return toreturn
-        
-    def used_tag(self,node,parameters=None):
+
+    def used_tag(self, node, parameters=None):
         return node.is_used()
-        
-        
+
     ################# Task Filters #########################################
     #That one is used to filters tag. Is it built dynamically each times
     #a tag is added to the tagstore
-    def tag_filter(self,node,parameters=None):
+    def tag_filter(self, node, parameters=None):
         #FIXME: we should take tag children into account
         #Bryce : use self.tagtree to find children/parents of tags
         tname = parameters['tag']
         toreturn = node.has_tags([tname])
         return toreturn
-        
-    def alltag(self,task,parameters=None):
+
+    def alltag(self, task, parameters=None):
         return True
-    
-    def notag(self,task,parameters=None):
+
+    def notag(self, task, parameters=None):
         """ Filter of tasks without tags """
         return task.has_tags(notag_only=True)
-        
-    def is_leaf(self,task,parameters=None):
+
+    def is_leaf(self, task, parameters=None):
         """ Filter of tasks which have no children """
         return not task.has_child()
-    
-    def is_workable(self,task,parameters=None):
+
+    def is_workable(self, task, parameters=None):
         """ Filter of tasks that can be worked """
         tree = task.get_tree()
         for child_id in task.get_children():
@@ -160,14 +158,14 @@
                 return False
 
         return True
-        
-    def is_started(self,task,parameters=None):
+
+    def is_started(self, task, parameters=None):
         '''Filter for tasks that are already started'''
         start_date = task.get_start_date()
-        if start_date :
+        if start_date:
             #Seems like pylint falsely assumes that subtraction always results
-            #in an object of the same type. The subtraction of dates 
-            #results in a datetime.timedelta object 
+            #in an object of the same type. The subtraction of dates
+            #results in a datetime.timedelta objec
             #that does have a 'days' member.
             difference = date_today() - start_date
             if difference.days == 0:
@@ -177,51 +175,51 @@
                 return difference.days > 0 #pylint: disable-msg=E1101
         else:
             return True
-            
-    def workview(self,task,parameters=None):
+
+    def workview(self, task, parameters=None):
         wv = self.active(task) and\
              self.is_started(task) and\
              self.is_workable(task) and\
              self.no_disabled_tag(task)
         return wv
-        
-    def workdue(self,task):
+
+    def workdue(self, task):
         ''' Filter for tasks due within the next day '''
         wv = self.workview(task) and \
              task.get_due_date() != no_date and \
              task.get_days_left() < 2
         return wv
 
-    def worklate(self,task):
+    def worklate(self, task):
         ''' Filter for tasks due within the next day '''
         wv = self.workview(task) and \
              task.get_due_date() != no_date and \
              task.get_days_late() > 0
         return wv
 
-    def workstarted(self,task):
+    def workstarted(self, task):
         ''' Filter for workable tasks with a start date specified '''
         wv = self.workview(task) and \
              task.start_date
         return wv
-        
-    def worktostart(self,task):
+
+    def worktostart(self, task):
         ''' Filter for workable tasks without a start date specified '''
         wv = self.workview(task) and \
              not task.start_date
         return wv
-        
-    def active(self,task,parameters=None):
+
+    def active(self, task, parameters=None):
         """ Filter of tasks which are active """
         #FIXME: we should also handle unactive tags
         return task.get_status() == Task.STA_ACTIVE
-        
-    def closed(self,task,parameters=None):
+
+    def closed(self, task, parameters=None):
         """ Filter of tasks which are closed """
         ret = task.get_status() in [Task.STA_DISMISSED, Task.STA_DONE]
         return ret
-        
-    def no_disabled_tag(self,task,parameters=None):
+
+    def no_disabled_tag(self, task, parameters=None):
         """Filter of task that don't have any disabled/nonworkview tag"""
         toreturn = True
         for t in task.get_tags():