~saurabhanandiit/gtg/exportFixed

« back to all changes in this revision

Viewing changes to GTG/core/task.py

Merge of my work on liblarch newbase and all the backends ported to liblarch
(which mainly means porting the datastore).
One failing test, will check it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
596
596
            
597
597
            self.content = "<content><tag>%s</tag>%s%s</content>" % (
598
598
                tagname, sep, c)
 
599
            #we modify the task internal state, thus we have to call for a sync
 
600
            self.sync()
599
601
 
600
602
    #remove by tagname
601
603
    def remove_tag(self, tagname):
610
612
        if modified:
611
613
            tag = self.req.get_tag(tagname)
612
614
            tag.modified()
613
 
                       
 
615
    
 
616
    def set_only_these_tags(self, tags_list):
 
617
        '''
 
618
        Given a list of strings representing tags, it makes sure that
 
619
        this task has those and only those tags.
 
620
        '''
 
621
        for tag in self.get_tags_name():
 
622
            try:
 
623
                tags_list.remove(tag)
 
624
            except:
 
625
                self.remove_tag(tag)
 
626
        for tag in tags_list:
 
627
            self.add_tag(tag)
 
628
 
614
629
    def _strip_tag(self, text, tagname,newtag=''):
615
630
        return (text
616
631
                    .replace('<tag>%s</tag>\n\n'%(tagname), newtag) #trail \n