@cherrypy.expose
    def template(self, *paths, **_ignored):
        template_name = '/'.join(paths)
        template_path = os.path.join(self.settings.templates, template_name)
        if os.path.isdir(template_path):
            return self.edit_renderer.directory(
                'Contents of ' + (template_name or 'template directory'),
                self.settings.templates, template_name,
                '/template/{}'.format,
                (lambda path: os.path.isdir(path) or '.htm' in path.lower())
            )
        else:  # A file
            document = _extract_document({}, template_name=template_name)
            if not document.template_name:
                raise cherrypy.HTTPRedirect('/timeout')
            return self.edit_renderer.render_editor(
                document.template_name,
                document.styles,
                actions=self._actions(document, **{TEMPLATE_PARAM_NAME: template_name}),
            )
dataset/ETHPy150Open KeepSafe/ks-email-parser/email_parser/gui/gui.py/Server.template/original