~huxuan/gtg/port-to-gtk3-py3

« back to all changes in this revision

Viewing changes to GTG/core/task.py

  • Committer: huxuan
  • Date: 2013-09-01 07:13:08 UTC
  • Revision ID: i@huxuan.org-20130901071308-7ikydcye0ecvr3fu
resolve some str related bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        # We should check for other task with the same title
129
129
        # In that case, we should add a number (like Tomboy does)
130
130
        old_title = self.title
131
 
        if isinstance(title, str):
132
 
            title = title.decode('utf8')
133
131
        if title:
134
132
            self.title = title.strip('\t\n')
135
133
        else:
606
604
        @param att_value: The value of the attribute. Will be converted to a
607
605
            string.
608
606
        """
609
 
        val = str(str(att_value), "UTF-8")
 
607
        val = str(att_value)
610
608
        self.attributes[(namespace, att_name)] = val
611
609
        self.sync()
612
610
 
663
661
        """
664
662
        Adds a tag. Does not add '@tag' to the contents. See add_tag
665
663
        """
666
 
        t = tagname.encode("UTF-8")
667
664
        # Do not add the same tag twice
668
 
        if not t in self.tags:
669
 
            self.tags.append(t)
 
665
        if not tagname in self.tags:
 
666
            self.tags.append(tagname)
670
667
            if self.is_loaded():
671
668
                for child in self.get_subtasks():
672
669
                    if child.can_be_deleted:
673
 
                        child.add_tag(t)
 
670
                        child.add_tag(tagname)
674
671
 
675
 
                tag = self.req.get_tag(t)
 
672
                tag = self.req.get_tag(tagname)
676
673
                if not tag:
677
 
                    tag = self.req.new_tag(t)
 
674
                    tag = self.req.new_tag(tagname)
678
675
                tag.modified()
679
676
            return True
680
677