Beispiel #1
0
    def list(cls, offset=0, limit=100):
        result = threads.list(offset=offset, limit=limit)
        if result is None:
            result = []
            for thread in Paginator(disqusapi.threads.list, forum=app.config['DISQUS_FORUM'], category=Category.get('General')['id'], method='GET'):
                result.append(Thread.save(thread))
            result.reverse()

        return result
Beispiel #2
0
    def list_by_author(cls, author_id, offset=0, limit=100):
        assert author_id == session['auth']['user_id']
        result = threads.list(author_id=author_id, offset=offset, limit=limit)
        if result is None:
            result = []
            for thread in api_call(disqusapi.users.listActiveThreads, forum=app.config['DISQUS_FORUM'], method='GET'):
                result.append(Thread.save(thread))
                score = thread['createdAt'].strftime('%s.%m')
                threads.add_to_set(thread['id'], score, author_id=author_id)
            result.reverse()

        return result
Beispiel #3
0
    def list(cls, offset=0, limit=100):
        result = threads.list(offset=offset, limit=limit)
        if result is None:
            result = []
            for thread in Paginator(disqusapi.threads.list,
                                    forum=app.config['DISQUS_FORUM'],
                                    category=Category.get('General')['id'],
                                    method='GET'):
                result.append(Thread.save(thread))
            result.reverse()

        return result
Beispiel #4
0
    def list_by_author(cls, author_id, offset=0, limit=100):
        assert author_id == session['auth']['user_id']
        result = threads.list(author_id=author_id, offset=offset, limit=limit)
        if result is None:
            result = []
            for thread in api_call(disqusapi.users.listActiveThreads,
                                   forum=app.config['DISQUS_FORUM'],
                                   method='GET'):
                result.append(Thread.save(thread))
                score = thread['createdAt'].strftime('%s.%m')
                threads.add_to_set(thread['id'], score, author_id=author_id)
            result.reverse()

        return result