@staticmethod
    def View(svc, basenode, route, session, has_perm, start, count):
        route_array = Digest.ParseRoute(route)
        item = basenode.GetItem(session.GetUser(), route_array, has_perm)
        if (not item):
            raise WrongArgs('route %s does not exist!' % route)
        if (not item.IsFile()):
            raise WrongArgs('route %s does not point to a file' % route)
        result = {}
        result['item'] = item.GetInfoForUser(session.GetUser())
        postinfo = Post.Post(item.realpath(), None)
        (result['content'], result['has_end']) = postinfo.GetContent(start, count)
        attachlist = postinfo.GetAttachListByType()
        result['picattach'] = attachlist[0]
        result['otherattach'] = attachlist[1]
        if (attachlist[0] or attachlist[1]):
            result['attachlink'] = item.GetAttachLink(session)
        svc.writedata(json.dumps(result))
dataset/ETHPy150Open HenryHu/pybbs/digest.py/Digest.View/original