@staticmethod
    def GET(svc, session, params, action):
        if (session is None): raise Unauthorized('login first')
        if not session.CheckScope('bbs'): raise NoPerm("out of scope")
        user = session.GetUser()
        boardname = svc.get_str(params, 'board', '')
        if (boardname):
            board = BoardManager.BoardManager.GetBoard(boardname)
            if (board is None): raise NotFound('board %s not found' % boardname)
            if (not board.CheckReadPerm(user)):
                raise NoPerm('permission denied')
            basenode = board.digest.root
            has_perm = user.IsDigestMgr() or user.IsSysop() or user.IsSuperBM()
        else:
            basenode = Digest.root
            has_perm = user.IsDigestMgr()

        if (action == "list"):
            route = svc.get_str(params, 'route')
            start = svc.get_int(params, 'start', 1)
            end = svc.get_int(params, 'end', start + DEFAULT_DIGEST_LIST_COUNT - 1)
            Digest.List(svc, basenode, route, start, end, session, has_perm)
            return
        elif (action == "view"):
            route = svc.get_str(params, 'route')
            start = svc.get_int(params, 'start', 0)
            count = svc.get_int(params, 'count', 0)
            Digest.View(svc, basenode, route, session, has_perm, start, count)
            return
        else:
            raise WrongArgs('unknown action %s' % action)
dataset/ETHPy150Open HenryHu/pybbs/digest.py/Digest.GET/original