예제 #1
0
파일: views.py 프로젝트: kadefor/kadeforDoc
def _show(filename,render=True):

    from uliweb.utils.rst import to_html
    from uliweb.core.template import template
#    if not filename.endswith('.rst'):
#        filename += '.rst'
    _f = application.get_file(filename+'.html', dir='files')
    if _f:
        def f():
            content = file(_f).read()
            return application.template('show_document.html', locals())
        response.write(f())
        return response
    else:
        _f = application.get_file(filename+'.txt', dir='files')
        if _f:
            def f():
                content = file(_f).read()
                return application.template('show_txt.html', locals())
            response.write(f())
            return response
        else:
            _f = application.get_file(filename+'.rst', dir='files')
            if _f:
                def f():
                    content = file(_f).read()
                    if render:
                        content = to_html(template(content, env=application.get_view_env()))
                    else:
                        content = to_html(content)
                    return application.template('show_document.html', locals())
                response.write(f())
                return response
            else:
                error("Can't find the file %s" % filename)
예제 #2
0
 def html(self):
     from uliweb import application
     f = file(application.get_file(self.layout, dir='templates'), 'rb')
     text = f.read()
     f.close()
     return str(uaml.Parser(text, self.writer))
예제 #3
0
 def html(self):
     from uliweb import application
     f = file(application.get_file(self.layout, dir='templates'), 'rb')
     text = f.read()
     f.close()
     return str(uaml.Parser(text, self.writer))
예제 #4
0
파일: views.py 프로젝트: zhangchunlin/abw
def updateip():
    return filedown(request.environ, application.get_file('updateip.py'))
예제 #5
0
파일: views.py 프로젝트: kadefor/testdoc
def robots():
    return filedown(request.environ, application.get_file('robots.txt'))
예제 #6
0
파일: views.py 프로젝트: kadefor/testdoc
def favicon():
    return filedown(request.environ, application.get_file('favicon.ico'))
예제 #7
0
파일: views.py 프로젝트: kadefor/kadeforDoc
def jpg(filename):
    return filedown(request.environ, application.get_file(filename+'.jpg', dir='files'))
예제 #8
0
파일: views.py 프로젝트: kadefor/kadeforDoc
def rss():
    return filedown(request.environ, application.get_file('rss.xml', dir='files'))
예제 #9
0
파일: views.py 프로젝트: kadefor/kadeforDoc
def tarbz2(filename):
    return filedown(request.environ, application.get_file(filename+'.tar.bz2', dir='files'), download=True)
예제 #10
0
파일: views.py 프로젝트: kadefor/kadeforDoc
def zip(filename):
    return filedown(request.environ, application.get_file(filename+'.zip', dir='files'), download=True)