-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomment.py
More file actions
33 lines (22 loc) · 992 Bytes
/
comment.py
File metadata and controls
33 lines (22 loc) · 992 Bytes
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
from string import Template
class Comment:
_values = None
_template = None
def __init__(self, template, username, timestamp, title, message, avatar):
self._values = {}
self._values['username'] = username
self._values['timestamp'] = timestamp
self._values['title'] = title
self._values['message'] = message
self._values['avatar'] = avatar
templateFile = open(template)
self._template = Template(templateFile.read())
templateFile.close()
def __str__(self):
return self._template.safe_substitute(self._values)
class DoomsDayMyDearComment(Comment):
def __init__(self, username, timestamp, title, message, avatar):
Comment.__init__(self, 'DoomsDayMyDear/DoomsDayMyDearComment.html', username, timestamp, title, message, avatar)
if __name__ == '__main__':
test = DoomsDayMyDearComment('ohmusama', '3 Nov 2012', 'No Comment', 'No seriously "No Comment"')
print(str(test))