diff --git a/sphinx/websupport/__init__.py b/sphinx/websupport/__init__.py index 373622eb1..8bc2a0b8b 100644 --- a/sphinx/websupport/__init__.py +++ b/sphinx/websupport/__init__.py @@ -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, diff --git a/sphinx/websupport/comments/sqlalchemystorage.py b/sphinx/websupport/comments/sqlalchemystorage.py index 63db1550e..085913fdf 100644 --- a/sphinx/websupport/comments/sqlalchemystorage.py +++ b/sphinx/websupport/comments/sqlalchemystorage.py @@ -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() diff --git a/tests/test_websupport.py b/tests/test_websupport.py index 464c8c74b..8f701cd2a 100644 --- a/tests/test_websupport.py +++ b/tests/test_websupport.py @@ -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:]