예제 #1
0
파일: web.py 프로젝트: pgm/supervisor
    def render(self):
        supervisord = self.context.supervisord
        form = self.context.form

        processname = form['processname']
        filename = form['filename']
        if not processname:
            content = 'No process name found'
        else:
            rpcinterface = SupervisorNamespaceRPCInterface(supervisord)
            content = rpcinterface.readNamedLog(processname, filename, -10000, 10000)

        root = self.clone()

        title = root.findmeld('title')
        title.content('Process %s : %s' % (processname, filename))

        tailbody = root.findmeld('tailbody')
        tailbody.content(content['data'])

        refresh_anchor = root.findmeld('refresh_anchor')
        refresh_anchor.attributes(
            href='log.html?processname=%s&filename=%s#bottom' % (
                urllib.quote(processname), urllib.quote(filename))
                )

        return root.write_xhtmlstring()