Skip to content

Commit

Permalink
fix issues pointed out by alberto
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed May 23, 2014
1 parent d0a620c commit 94f0869
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions osclib/comments.py
Expand Up @@ -104,19 +104,21 @@ def delete(self, comment_id):

def delete_children(self, comments):
"""Removes the comments that have no childs
:param comments dict of id->comment dict
:return same hash without the deleted comments
"""
:param comments dict of id->comment dict
:return same hash without the deleted comments
"""
parents = []
for comment in comments.values():
if comment['parent']:
parents.append(comment['parent'])
for id in comments.keys():
if id not in parents:
self.delete(id)
del comments[id]
return comments
parents.append(comment['parent'])

for id_ in comments:
if id_ not in parents:
self.delete(id_)
del comments[id_]

return comments

def delete_from(self, request_id=None, project_name=None,
package_name=None):
Expand Down

0 comments on commit 94f0869

Please sign in to comment.