renamed get_comments get_data

This commit is contained in:
Jacob Mason 2010-08-04 13:12:57 -05:00
parent 75ae087f7a
commit 338c349dd5
3 changed files with 9 additions and 9 deletions

View File

@ -157,7 +157,7 @@ class WebSupport(object):
document['title'] = 'Search Results'
return document
def get_comments(self, node_id, username=None, moderator=False):
def get_data(self, node_id, username=None, moderator=False):
"""Get the comments and source associated with `node_id`. If
`user_id` is given vote information will be included with the
returned comments. The default CommentBackend returns dict with
@ -191,7 +191,7 @@ class WebSupport(object):
:param node_id: the id of the node to get comments for.
:param user_id: the id of the user viewing the comments.
"""
return self.storage.get_comments(node_id, username, moderator)
return self.storage.get_data(node_id, username, moderator)
def add_comment(self, text, node_id='', parent_id='', displayed=True,
username=None, rating=0, time=None, proposal=None,

View File

@ -58,7 +58,7 @@ class SQLAlchemyStorage(StorageBackend):
session.close()
return comment
def get_comments(self, node_id, username, moderator):
def get_data(self, node_id, username, moderator):
session = Session()
node = session.query(Node).filter(Node.id == node_id).one()
session.close()

View File

@ -91,7 +91,7 @@ def test_comments(support):
node_id=str(second_node.id))
# Access the comments as a moderator.
data = support.get_comments(str(first_node.id), moderator=True)
data = support.get_data(str(first_node.id), moderator=True)
comments = data['comments']
children = comments[0]['children']
assert len(comments) == 2
@ -100,7 +100,7 @@ def test_comments(support):
assert children[1]['text'] == 'Hidden child test comment'
# Access the comments without being a moderator.
data = support.get_comments(str(first_node.id))
data = support.get_data(str(first_node.id))
comments = data['comments']
children = comments[0]['children']
assert len(comments) == 1
@ -115,10 +115,10 @@ def test_voting(support):
nodes = session.query(Node).all()
node = nodes[0]
comment = support.get_comments(str(node.id))['comments'][0]
comment = support.get_data(str(node.id))['comments'][0]
def check_rating(val):
data = support.get_comments(str(node.id))
data = support.get_data(str(node.id))
comment = data['comments'][0]
assert comment['rating'] == val, '%s != %s' % (comment['rating'], val)
@ -137,7 +137,7 @@ def test_voting(support):
# Make sure past voting data is associated with comments when they are
# fetched.
data = support.get_comments(str(node.id), username='user_two')
data = support.get_data(str(node.id), username='user_two')
comment = data['comments'][0]
assert comment['vote'] == 1, '%s != 1' % comment['vote']
@ -147,7 +147,7 @@ def test_proposals(support):
nodes = session.query(Node).all()
node = nodes[0]
data = support.get_comments(str(node.id))
data = support.get_data(str(node.id))
source = data['source']
proposal = source[:5] + source[10:15] + 'asdf' + source[15:]