comparison examples/tutorial/geddit/model.py @ 625:dba522b4c31d

GenshiTutorial: implemented AJAX commenting.
author cmlenz
date Fri, 31 Aug 2007 17:01:00 +0000
parents 71d3edd302ae
children
comparison
equal deleted inserted replaced
624:1d23dddd6c2d 625:dba522b4c31d
13 13
14 def __repr__(self): 14 def __repr__(self):
15 return '<%s %r>' % (type(self).__name__, self.title) 15 return '<%s %r>' % (type(self).__name__, self.title)
16 16
17 def add_comment(self, username, content): 17 def add_comment(self, username, content):
18 self.comments.append(Comment(username, content)) 18 comment = Comment(username, content)
19 self.comments.append(comment)
20 return comment
19 21
20 22
21 class Comment(object): 23 class Comment(object):
22 24
23 def __init__(self, username, content): 25 def __init__(self, username, content):
24 self.username = username 26 self.username = username
25 self.content = content 27 self.content = content
26 self.time = datetime.utcnow() 28 self.time = datetime.utcnow()
27 29
28 def __repr__(self): 30 def __repr__(self):
29 return '<%s>' % (type(self).__name__) 31 return '<%s by %r>' % (type(self).__name__, self.username)
Copyright (C) 2012-2017 Edgewall Software