Allura/allura/model/discuss.py
def find_i(posts):
                '''Find the index number of this post in the display order'''
                q = []

                def traverse(posts):
                    for p in posts:
                        if p['post']._id == self._id:
                            return True  # found
                        q.append(p)
                        if traverse(p['children']):
                            return True
                traverse(posts)
                return len(q)
Find the index number of this post in the display order
Find the index number of this post in the display order
Find the index number of this post in the display order
def find_i(posts):
                q = []
                def traverse(posts):
                    for p in posts:
                        if p['post']._id == self._id:
                            return True  
                        q.append(p)
                        if traverse(p['children']):
                            return True
                traverse(posts)
                return len(q)
def find_i ( posts ) : q = [ ] def traverse ( posts ) : for p in posts : if p [ 'post' ] . _id == self . _id : return True q . append ( p ) if traverse ( p [ 'children' ] ) : return True traverse ( posts ) return len ( q )
Find the index number of this post in the display order
Find the index number of this post in the display order
'''Find the index number of this post in the display order''' # found
posts