/usr/share/pyshared/lpltk/message.py is in python-launchpadlib-toolkit 2.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/usr/bin/python
from utils import (
o2str,
typecheck_Entry
)
from person import Person
# Message
#
class Message(object):
# __init__
#
def __init__(self, tkbug, lpmessage):
self.__tkbug = tkbug
self.__commit_changes = tkbug.commit_changes
self.__message = typecheck_Entry(lpmessage)
self.__owner = None
self.__content = None
self.__date_created = None
self.__parent = None
self.__subject = None
# owner
#
@property
def owner(self):
if self.__owner == None:
self.__owner = Person(self.__tkbug, self.__message.owner)
return self.__owner
# content
@property
def content(self):
if self.__content == None:
self.__content = o2str(self.__message.content)
return self.__content
# date_created
@property
def date_created(self):
if self.__date_created == None:
self.__date_created = self.__message.date_created
return self.__date_created
# age
@property
def age(self):
'''Number of days since message was posted'''
t = self.date_created
now = t.now(t.tzinfo)
return 0 + (now - t).days
# parent
@property
def parent(self):
if self.__parent == None:
self.__parent = Message(self.__tkbug, self.__message.parent)
return self.__parent
# subject
@property
def subject(self):
if self.__subject == None:
self.__subject = o2str(self.__message.subject)
return self.__subject
# vi:set ts=4 sw=4 expandtab:
|