~remy/+junk/gtg_mydate

« back to all changes in this revision

Viewing changes to GTG/core/task.py

  • Committer: Paulo Cabido
  • Date: 2009-08-01 01:55:44 UTC
  • mfrom: (269.4.17 hamster2)
  • Revision ID: paulo.cabido@gmail.com-20090801015544-03mrzl5v4lft4xnk
Merge with Kevin Mehall's hamster-plugin branch. This merge also adds attributes to the tasks

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        self.loaded = newtask
51
51
        if self.loaded :
52
52
            self.req._task_loaded(self.tid)
 
53
        self.attributes={}
53
54
                
54
55
    def is_loaded(self) :
55
56
        return self.loaded
366
367
        else :
367
368
            to_return = len(self.parents)!=0
368
369
        return to_return
 
370
        
 
371
    def set_attribute(self, att_name, att_value, namespace=""):
 
372
        """Set an arbitrary attribute.
 
373
 
 
374
        @param att_name: The name of the attribute.
 
375
        @param att_value: The value of the attribute. Will be converted to a
 
376
            string.
 
377
        """
 
378
        val = unicode(str(att_value), "UTF-8")
 
379
        self.attributes[(namespace,att_name)] = val
 
380
        self.sync()
 
381
        
 
382
    def get_attribute(self, att_name, namespace=""):
 
383
        """Get the attribute C{att_name}.
 
384
 
 
385
        Returns C{None} if there is no attribute matching C{att_name}.
 
386
        """
 
387
        return self.attributes.get((namespace,att_name), None)
369
388
       
370
389
    #Method called before the task is deleted
371
390
    #This method is called by the datastore and should not be called directly