Allura/allura/model/discuss.py
def url_paginated(self):
        '''Return link to the thread with a #target that poins to this comment.

        Also handle pagination properly.
        '''
        if not self.thread:  # pragma no cover
            return None
        limit, p, s = g.handle_paging(None, 0)  # get paging limit
        if self.query.find(dict(thread_id=self.thread._id)).count() <= limit:
            # all posts in a single page
            page = 0
        else:
            posts = self.thread.find_posts()
            posts = self.thread.create_post_threads(posts)

            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)

            page = find_i(posts) / limit

        slug = h.urlquote(self.slug)
        aref = ArtifactReference.query.get(_id=self.thread.ref_id)
        if aref and aref.artifact:
            url = aref.artifact.url()
        else:
            url = self.thread.url()
        if page == 0:
            return '%s?limit=%s#%s' % (url, limit, slug)
        return '%s?limit=%s&page=%s#%s' % (url, limit, page, slug)
Return link to the thread with a #target that poins to this comment.

        Also handle pagination properly.
        
Return link to the thread with a #target that poins to this comment.
Also handle pagination properly.
Return link to the thread with a #target that poins to this comment . Also handle pagination properly .
def url_paginated(self):
        if not self.thread:  
            return None
        limit, p, s = g.handle_paging(None, 0)  
        if self.query.find(dict(thread_id=self.thread._id)).count() <= limit:
            page = 0
        else:
            posts = self.thread.find_posts()
            posts = self.thread.create_post_threads(posts)
            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)
            page = find_i(posts) / limit
        slug = h.urlquote(self.slug)
        aref = ArtifactReference.query.get(_id=self.thread.ref_id)
        if aref and aref.artifact:
            url = aref.artifact.url()
        else:
            url = self.thread.url()
        if page == 0:
            return '%s?limit=%s#%s' % (url, limit, slug)
        return '%s?limit=%s&page=%s#%s' % (url, limit, page, slug)
def url_paginated ( self ) : if not self . thread : return None limit , p , s = g . handle_paging ( None , 0 ) if self . query . find ( dict ( thread_id = self . thread . _id ) ) . count ( ) <= limit : page = 0 else : posts = self . thread . find_posts ( ) posts = self . thread . create_post_threads ( posts ) 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 q . append ( p ) if traverse ( p [ 'children' ] ) : return True traverse ( posts ) return len ( q ) page = find_i ( posts ) / limit slug = h . urlquote ( self . slug ) aref = ArtifactReference . query . get ( _id = self . thread . ref_id ) if aref and aref . artifact : url = aref . artifact . url ( ) else : url = self . thread . url ( ) if page == 0 : return '%s?limit=%s#%s' % ( url , limit , slug ) return '%s?limit=%s&page=%s#%s' % ( url , limit , page , slug )
Return link to the thread with a #target that poins to this comment.
Return link to the thread with a #target that poins to this comment .
'''Return link to the thread with a #target that poins to this comment.

        Also handle pagination properly.
        ''' # pragma no cover # get paging limit # all posts in a single page '''Find the index number of this post in the display order''' # found
self