def dump(self, tz=None): ''' Level 1 serialization: console output. This level targets console output. It only digests essnetial information which end users can understand. e.g. the text of a status is digested whereas the ID fields is not digested. To control the format, please rewrite dump() in derived Message class. See also __str__(), __unicode__(), show() ''' if tz: return unicode("[%s] at %s \n %s") % \ (self.parsed.username, utils.utc2str(self.parsed.time, tz), self.parsed.text) else: return unicode("[%s] at %s \n %s") % \ (self.parsed.username, utils.utc2str(self.parsed.time), self.parsed.text)
def __unicode__(self): ''' Level 1 serialization and convert to unicode See dump() ''' # NOTE: # # dump() method remains stable because the downstream is # digest methods. The __str__ and __unicode__ are only # for console interaction. Normal apps should refer to # those fields in 'parsed' themselves. # # We limit the output to 500 characters to make the console # output uncluttered. return unicode("[%s] at %s \n %s") % (self.parsed.username, utils.utc2str(self.parsed.time), self.parsed.text[0:500])