class GetDataFrameView(JSONRequestHandler): def prepare(self): tmpl_file = os.path.join(self.get_template_path(),"jqgrid_view.html") if not(os.path.isdir(self.get_template_path())): self.set_status(500) self.finish("Template path does not exist") return with codecs.open(tmpl_file) as f: self.tmpl = Template(f.read()) def get(self, objid): import pandas as pd # by default the object is placed in self.object if not isinstance(context.object, pd.DataFrame): self.set_status(500) self.finish("Object exists, but is not a dataframe") return base = "http://{host}/pandas".format(host=self.request.host) body = self.tmpl.generate(api_url=base, objid=objid, static_url=self.static_url) self.write(body)
def render_template(template_name, **kwargs): """ 填充模板 :param template_name: 模板名称 :param kwargs: 填充参数 :return: 填充后的结果 """ if template_name: global TEMPLATES_CACHE if template_name in TEMPLATES_CACHE.keys(): return TEMPLATES_CACHE.get(template_name) else: path = os.path.join(settings.TEMPLATE_PATH, template_name) if os.path.exists(path): template = None try: with open(path) as template: t_content = template.read() if t_content: TEMPLATES_CACHE[template_name] = t_content finally: if template: template.close() else: raise FileNotFoundError("Template '%s' not found. " % template_name) t_content = TEMPLATES_CACHE.get(template_name) if t_content: if t_content: t = Template(t_content) return t.generate(**kwargs) return ''
def render(template_file, data=None): if (data is None): data = {} t = Template(open("public/views/{0}".format(template_file), "r").read()) return t.generate(**data)
def Requestlink_list(self, ResourceListName, ResourceList, PluginInfo): link_list = [] for Name, Resource in ResourceList: Chunks = Resource.split('###POST###') URL = Chunks[0] POST = None Method = 'GET' if len(Chunks) > 1: # POST Method = 'POST' POST = Chunks[1] Transaction = self.requester.get_transaction(True, URL, Method, POST) if Transaction is not None and Transaction.found: RawHTML = Transaction.get_raw_response_body() FilteredHTML = self.reporter.sanitize_html(RawHTML) NotSandboxedPath = self.plugin_handler.dump_output_file("NOT_SANDBOXED_%s.html" % Name, FilteredHTML, PluginInfo) logging.info("File: NOT_SANDBOXED_%s.html saved to: %s", Name, NotSandboxedPath) iframe_template = Template(""" <iframe src="{{ NotSandboxedPath }}" sandbox="" security="restricted" frameborder='0' style="overflow-y:auto; overflow-x:hidden;width:100%;height:100%;" > Your browser does not support iframes </iframe> """) iframe = iframe_template.generate(NotSandboxedPath=NotSandboxedPath.split('/')[-1]) SandboxedPath = self.plugin_handler.dump_output_file("SANDBOXED_%s.html" % Name, iframe, PluginInfo) logging.info("File: SANDBOXED_%s.html saved to: %s", Name, SandboxedPath) link_list.append((Name, SandboxedPath)) plugin_output = dict(PLUGIN_OUTPUT) plugin_output["type"] = "Requestlink_list" plugin_output["output"] = {"ResourceListName": ResourceListName, "link_list": link_list} return ([plugin_output])
def train_method(handler): """ Train, test dataset. Note that `handler.get_argument('arg')` is used to read URL parameters """ url = handler.get_argument('url') url = op.join(YAMLPATH, url) df = cache.open(url) # model, testSize and targetCol are part of the arguments sent via `train_method` AJAX call. clf = locate(handler.get_argument('model'))() test_size = float(handler.get_argument('testSize')) / 100 target_col = handler.get_argument('targetCol') dfy = df[target_col] dfx = df[[c for c in df if c != target_col]] x, y = dfx.values, dfy.values # train/test data split, fit to classifier and determine accuracy xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size=test_size, shuffle=True, stratify=y) clf.fit(xtrain, ytrain) score = clf.score(xtest, ytest) # output is rendered to report.html with open(op.join(YAMLPATH, 'report.html'), 'r', encoding='utf8') as fout: tmpl = Template(fout.read()) viz = _make_chart(clf, dfx) return tmpl.generate(score=score, model=clf, spec=viz)
def get(self, id): try: dog = db_session.query(Dog).filter(Dog.id == id).one() t = Template('<img alt="dog_image" src="data:image/jpeg;base64,{{ img }}" />') self.write(t.generate(img=dog.image)) except: self.write("Dog not found")
def send_schedule_report(section_email, pools_info, pools_allocated_mem, start_time, end_time): """ Send the schedule report. Steps: 1. Fill the report data in a html template. 2. Transform the html template to string message. 3. Send email using the above message. :param section_email: (dict) The email section of configuration in ../conf/scheduler.yml. :param pools_info: (dict) The information about the configuration and statistics of the pool participating in the scheduling. :param pools_allocated_mem: (dict) The allocated memory of the pool participating in the scheduling. :param start_time: (datetime) The start time to fetching query information. :param end_time: (datetime) The end time to fetching query information. """ report_data = generate_schedule_report_data(pools_info, pools_allocated_mem) with open(REPORT_TEMPLATE_PATH, "r") as f: html_template = f.read() hd = Template(html_template) text = hd.generate(df=report_data, schedule_start_time=start_time, schedule_end_time=end_time).decode("utf8") message = MIMEText(text, _subtype="html") message["Subject"] = Header( "{} ~ {} impala memory schedule report".format(start_time, end_time), "utf-8") send_email(section_email, message)
def render_text(text, template_name="<string>", **kw): """使用模板引擎渲染文本信息""" nkw = {} pre_render(nkw) nkw.update(kw) template = Template(text, name=template_name, loader=_loader) return template.generate(**nkw)
def test_unicode_literal_expression(self): # Unicode literals should be usable in templates. Note that this # test simulates unicode characters appearing directly in the # template file (with utf8 encoding), i.e. \u escapes would not # be used in the template file itself. template = Template(utf8(u'{{ "\u00e9" }}')) self.assertEqual(template.generate(), utf8(u"\u00e9"))
def send_thanks(recepient, fundraiser_name, amount, donation_date): # bit messy, make this cleaner donation_date = (donation_date + timedelta(hours=10)).strftime('%H:%M:%S %Y-%m-%d AEST') basepath = os.path.dirname(__file__) filepath = os.path.join(basepath, 'email.html') with open(filepath) as f: raw_template = f.read() t = Template(raw_template) parsed_template = t.generate(title='{} - Thank you'.format(fundraiser_name), donation_date=donation_date, fundraiser_name=fundraiser_name, donation_amount=amount) message = MIMEMultipart('related') msg_html = MIMEText(parsed_template, 'html') message.attach(msg_html) message['Subject'] = '{} - Thank you'.format(fundraiser_name) message['From'] = FROM message['To'] = recepient send(recepient, FROM, message.as_string())
def new(): '''Create a new ticket. $EDITOR will be opened and used to edit the case. The case template has an "header" in .yaml format. "Title", "Project", "Area", "Files", etc. are all available fields. The body of the ticket is separated by "---". Example: >>> new ''' tmpl = Template('''Title: <title> Project: <project> # Area: <area> # Assign to: {{ user.fullname }} # Priority: Need to fix # Parent: <id> # Milestone: Infrastructure and Internal Errors # Tags: <list> --- <Insert description here> ''') # noqa header = tmpl.generate(user=CURRENT_USER).decode('utf-8') with editor.writing(header=header) as text: editor.abort_if_empty(text) params = text.get_params_for_new() FBCase.new(**params)
def render_text(text, **kw): nkw = {} pre_render(nkw) nkw.update(kw) # TODO 需要优化 template = Template(text, name="<string>", loader=_loader) return template.generate(**nkw)
def _show_login_window(self, next="/", message=None, login_template=None): if not login_template: login_template = self.settings.get('login_template', LOGIN_PAGE_TEMPLATE) t = Template(login_template) html = t.generate(next=next, message=message) self.write(html) self.finish()
def RequestLinkList(self, ResourceListName, ResourceList, PluginInfo): # for Name, Resource in Core.Config.GetResources('PassiveRobotsAnalysisHTTPRequests'): LinkList = [] for Name, Resource in ResourceList: Chunks = Resource.split('###POST###') URL = Chunks[0] POST = None Method = 'GET' if len(Chunks) > 1: # POST Method = 'POST' POST = Chunks[1] Transaction = self.requester.GetTransaction(True, URL, Method, POST) if Transaction.Found: RawHTML = Transaction.GetRawResponseBody() FilteredHTML = self.reporter.sanitize_html(RawHTML) NotSandboxedPath = self.plugin_handler.DumpOutputFile("NOT_SANDBOXED_" + Name + ".html", FilteredHTML, PluginInfo) logging.info("File: " + "NOT_SANDBOXED_" + Name + ".html" + " saved to: " + NotSandboxedPath) iframe_template = Template(""" <iframe src="{{ NotSandboxedPath }}" sandbox="" security="restricted" frameborder = '0' style = "overflow-y:auto; overflow-x:hidden;width:100%;height:100%;" > Your browser does not support iframes </iframe> """) iframe = iframe_template.generate(NotSandboxedPath=NotSandboxedPath.split('/')[-1]) SandboxedPath = self.plugin_handler.DumpOutputFile("SANDBOXED_" + Name + ".html", iframe, PluginInfo) logging.info("File: " + "SANDBOXED_" + Name + ".html" + " saved to: " + SandboxedPath) LinkList.append(( Name, SandboxedPath )) plugin_output = dict(PLUGIN_OUTPUT) plugin_output["type"] = "RequestLinkList" plugin_output["output"] = {"ResourceListName": ResourceListName, "LinkList": LinkList} return ([plugin_output])
def post(self): error = None try: username = self.request.arguments['username'][0] if len(username) == 0: raise Exception('bad username') """if get_user(username) == True: error = 'Username already exists.' raise Exception()""" except: if not error == None: error = 'A non-zero length username is required.' try: password = self.request.arguments['password'][0] if len(password) == 0: raise Exception('bad password') except: if not error == None: error = 'A non-zero length password is required.' print username """add_account(username, password)""" if error == None: t = Template(open('templates/client_sample.html', 'r').read()) client_sample_code = t.generate(username=username) self.render('templates/index.html', code=client_sample_code) else: self.render('templates/register.html', error=error)
def _entry_to_html(self, entry): t = Template(self._html_entry) return text_type(t.generate(source=entry.source, anchor=entry.anchor, id=entry.id, link=entry.link, title=entry.title, author=entry.author, updated=entry.updated, updated_str=self._date_to_str(entry.updated), content=entry.content), 'UTF-8')
def get(self): b = Template(string) books=['Learning Python', 'Programming Collective Intelligence', 'Restful Web Services'] content = b.generate(title='Home Page', header='Books that are great', books=books) self.write(content)
def compile_hook(protocol, host, port, path): with open("templates/hook.js", "r") as f: t = Template(f.read()) js = t.generate(protocol=protocol, host=host, port=str(port), path=path) return jsmin(js)
def test_try(self): template = Template(utf8("""{% try %} try{% set y = 1/x %} {% except %}-except {% else %}-else {% finally %}-finally {% end %}""")) self.assertEqual(template.generate(x=1), b"\ntry\n-else\n-finally\n") self.assertEqual(template.generate(x=0), b"\ntry-except\n-finally\n")
def render(tpl_text, **kwargs): """ render a template :param tpl_text: template text :param context: dict object :return: str """ tpl = Template(tpl_text) return tpl.generate(**kwargs).decode("utf-8")
def main(): """ Starts the app based on cli arguments """ encoder = Binary2DictlessEnglish(options.dictionary) with open(options.target, "rb") as in_file: data = encoder.encode_file(in_file) with open(options.template) as templ_file: templ = Template(templ_file.read()) with open(options.output, "wb") as out_file: out_file.write(templ.generate(data=data))
def render(tpl_text, context): """ render a template :param tpl_text: template text :param context: dict object :return: str """ tpl = Template(tpl_text) return tpl.generate(context)
def test_no_inherit_future(self): # TODO(bdarnell): make a test like this for one of the future # imports available in python 3. Unfortunately they're harder # to use in a template than division was. # This file has from __future__ import division... self.assertEqual(1 / 2, 0.5) # ...but the template doesn't template = Template("{{ 1 / 2 }}") self.assertEqual(template.generate(), "0")
def test_no_inherit_future(self): # TODO(bdarnell): make a test like this for one of the future # imports available in python 3. Unfortunately they're harder # to use in a template than division was. # This file has from __future__ import division... self.assertEqual(1 / 2, 0.5) # ...but the template doesn't template = Template('{{ 1 / 2 }}') self.assertEqual(template.generate(), '0')
def DumpFile( self, Filename, Contents, PluginInfo, LinkName = '' ): save_path = self.Core.PluginHandler.DumpOutputFile( Filename, Contents, PluginInfo ) if not LinkName: LinkName = save_path logging.info("File: "+Filename+" saved to: "+save_path) template = Template( """ <a href="{{ Link }}" target="_blank"> {{ LinkName }} </a> """ ) return [ save_path, template.generate( LinkName = LinkName, Link = "../../../" + save_path ) ]
def DumpFile(self, Filename, Contents, PluginInfo, LinkName=''): save_path = self.plugin_handler.dump_output_file(Filename, Contents, PluginInfo) if not LinkName: LinkName = save_path logging.info("File: %s saved to: %s", Filename, save_path) template = Template(""" <a href="{{ Link }}" target="_blank"> {{ LinkName }} </a> """) return [save_path, template.generate(LinkName=LinkName, Link="../../../%s" % save_path)]
def test_unicode_literal_expression(self): # Unicode literals should be usable in templates. Note that this # test simulates unicode characters appearing directly in the # template file (with utf8 encoding), i.e. \u escapes would not # be used in the template file itself. if str is unicode: # python 3 needs a different version of this test since # 2to3 doesn't run on template internals template = Template(utf8(u'{{ "\u00e9" }}')) else: template = Template(utf8(u'{{ u"\u00e9" }}')) self.assertEqual(template.generate(), utf8(u"\u00e9"))
def test_unicode_literal_expression(self): # Unicode literals should be usable in templates. Note that this # test simulates unicode characters appearing directly in the # template file (with utf8 encoding), i.e. \u escapes would not # be used in the template file itself. if str is unicode_type: # python 3 needs a different version of this test since # 2to3 doesn't run on template internals template = Template(utf8(u'{{ "\u00e9" }}')) else: template = Template(utf8(u'{{ u"\u00e9" }}')) self.assertEqual(template.generate(), utf8(u"\u00e9"))
class IndexHandler(RequestHandler): def initialize(self, **kwargs): self.logger = kwargs["logger"] self.mysql = kwargs["cfg"]["mysql"] self.redis = tornadoredis.Client(connection_pool=kwargs["redis"]) self.cfg = kwargs["cfg"] self.template = Template("op -cmd {{ cmd }} -value {{ value }}") @staticmethod def _customize(self): self.set_header("Server", "IRR") self.set_header("Content-Type", "application/json; charset=UTF-8") @tornado.gen.coroutine def _redis(self): info = yield tornado.gen.Task(self.redis.info) yield tornado.gen.Task(self.redis.disconnect) raise tornado.gen.Return(info) @tornado.gen.coroutine def _mysql(self): db = torndb.Connection(self.mysql['host'], self.mysql['database'], user=self.mysql['user'], password=self.mysql['password']) hosts = [host for host in db.query("SELECT Host FROM user WHERE User = '******'")] raise tornado.gen.Return(hosts) @tornado.gen.coroutine def _handle(self, **kwargs): IndexHandler._customize(self) db = None try: hosts = yield tornado.gen.Task(self._mysql) info = yield tornado.gen.Task(self._redis) data = { 'cmd': "any", 'value': str(int(time.time())) } response = { 'status': 200, 'msg': self.template.generate(**data), 'redis': info['redis_version'], 'mysql': hosts, 'cfg': self.cfg } except Exception as ex: response = { 'status': 500, 'msg': str(ex) } finally: if db: db.close() if response['status'] != 200: self.set_status(response['status']) self.write(json_encode(response)) self.finish() @tornado.web.asynchronous def get(self): self._handle()
def render_snakeviz(name, sessions): import snakeviz from snakeviz.stats import json_stats, table_rows SNAKEVIZ_PATH = os.path.join(os.path.dirname(snakeviz.__file__), 'templates', 'viz.html') with open(SNAKEVIZ_PATH) as f: SNAKEVIZ_TEMPLATE = Template(f.read()) pstats = Stats(sessions[0]) for session in sessions[1:]: pstats.add(session) rendered = SNAKEVIZ_TEMPLATE.generate( profile_name=name, table_rows=table_rows(pstats), callees=json_stats(pstats) ).decode('utf-8').replace('/static/', '/snakeviz/static/') return escape(rendered), "background-color: white;"
def create_file_from_template(template_filename, d, filename): #template_file = os.path.dirname(os.path.realpath(__file__)) + "\\templates\\" + template_filename template_file = os.path.join(os.path.dirname(__file__), "templates", template_filename) r = open(template_file, 'r', encoding='utf-8') content = r.read() r.close() t = TT(content) c = t.generate(**d) f = open(filename, 'w', encoding='utf-8') f.write(c.decode('utf-8')) f.close()
def get_pdf(coll_model,ent_id): res = coll_model.find_one({"_id":utils.create_objectid(ent_id)}) t = Template(open(os.path.join(get_root_path(),'static','rml.rml')).read()) add_time = res["add_time"].split(".")[0].replace("-",".") report_time = datetime.datetime.now().strftime('%Y.%m.%d %H:%M:%S') _rml = t.generate(item=res,time=report_time,add_time=add_time) rml = _rml.encode('utf-8') name = str(time.time()).replace('.','') + "-1" + '.pdf' uri = os.path.join(get_root_path(),'static','report',time.strftime('%Y'),time.strftime('%m-%d'),name) if not os.path.exists(os.path.dirname(uri)): os.makedirs(os.path.dirname(uri), mode=0777) trml2pdf.parseString(rml,uri) return "http://"+options.domain+uri.split("dxb")[1]
def run(self): if not self.cmd_file_url: raise exception_response( 500, title='run requires a cmd_file_url input to the ctor.') response, _ = UrlFetch().get(self.location(self.cmd_file_url)[0]) t = Template(response) cmds_templated = t.generate(today=today_str, as_date=as_date, roll_date=roll_date, parse_xml=parse_xml, **self.location.request.arguments) cmds = self.parse_commands(cmds_templated) self.run_cmds(cmds) return cmds
def test_break_continue(self): template = Template(utf8("""\ {% for i in range(10) %} {% if i == 2 %} {% continue %} {% end %} {{ i }} {% if i == 6 %} {% break %} {% end %} {% end %}""")) result = template.generate() # remove extraneous whitespace result = b''.join(result.split()) self.assertEqual(result, b"013456")
def _write_by_template(self, data): directory = 'docs/python/numpy' templateRst = '_template.rst' if os.path.exists(os.path.join(os.getcwd(), directory)) == False: os.mkdir(directory) outString = '' with open(os.path.join(os.getcwd(), directory, templateRst), 'r') as file: temp = Template(file.read()) outString = temp.generate(data=data) with open(os.path.join(os.getcwd(), directory, data.title + ".rst"), 'w', encoding='utf-8') as wf: wf.write(outString.decode("utf-8"))
def post(self): #print dir(self.request) url = self.get_argument('url','') params = self.get_argument('params','') print url,params if url and params: _p = re.sub('\n|\r|&','',params)+app_key print _p sign = md5(_p) t = Template(template) r = urllib2.urlopen(url,params) r = r.read() self.write(t.generate(url=url,params=params,r=r)) self.write('<br>') self.write(sign)
def settings_template(path, **kwargs): """ Renders and returns the Tornado template at *path* using the given *kwargs*. .. note:: Any blank lines in the rendered template will be removed. """ from tornado.template import Template with io.open(path, mode='r', encoding='utf-8') as f: template_data = f.read() t = Template(template_data) # NOTE: Tornado returns templates as bytes, not unicode. That's why we need # the decode() below... rendered = t.generate(**kwargs).decode('utf-8') out = "" for line in rendered.splitlines(): if line.strip(): out += line + "\n" return out
def get(self, path): if not path: path = "." if path.startswith("/"): self.write("Only relative paths are allowed") self.set_status(403) self.finish() return t = Template(get_asset("browse.html")) args = dict(path=path, listing=utils.get_listing(path), format_prefix=utils.format_prefix, stat=stat, get_stat=utils.get_stat, os=os, css=get_asset("bootstrap.css")) self.write(t.generate(**args)) self.finish()
class PingPongView(JSONRequestHandler): """ This view provides the HTML to the client """ def get(self): #note no leading slash, common cause of errors tmpl_file = os.path.join(self.get_template_path(),"index.html") if not(os.path.isdir(self.get_template_path())): self.set_status(500) return self.finish("Template path does not exist") with codecs.open(tmpl_file) as f: self.tmpl = Template(f.read()) static_base=self.static_url("")[:-1] # strip trailing slash result= self.tmpl.generate(static_base=static_base, ws_url=context.get_ws_url(), static_url=self.static_url) self.write(result)
def render(self, template_path, kwargs=None): """ 根据模板渲染并生成字符串返回 :param template_path: 模板文件路径 :param kwargs: 包含写入模板中的变量数据和函数等 :return: 渲染后的内容 """ template_path = os.path.join(self.template_root_path, template_path) if kwargs is None: kwargs = {} with open(template_path, "r", encoding="utf-8") as fp: temp = Template(fp.read(), autoescape=None, loader=Loader(self.template_root_path)) glob_content = {**self.glob_content, **kwargs} return temp.generate(**glob_content)
def get(self, path): t = Template(get_asset("file.html")) if path is None: self.set_status(404) self.write("No such file") self.finish() return if path.startswith("/"): self.write("Only relative paths are allowed") self.set_status(403) self.finish() return args = dict( filename=path, jquery=get_asset("jquery.js"), pailer=get_asset("jquery.pailer.js"), css=get_asset("bootstrap.css"), ) self.write(t.generate(**args)) self.finish()
def get(self, path): if not path: path = "." if path.startswith("/"): self.write("Only relative paths are allowed") self.set_status(403) self.finish() return t = Template(get_asset("browse.html")) args = dict( path=path, listing=utils.get_listing(path), format_prefix=utils.format_prefix, stat=stat, get_stat=utils.get_stat, os=os, css=get_asset("bootstrap.css"), ) self.write(t.generate(**args)) self.finish()
def saveConfFiles(self, dbtype, driver, user, password, host, name): import ConfigParser from tornado.template import Template # extract string from template and form string configTemplatePath = os.path.join(os.path.dirname(__file__), "dbsetting.template") with open(configTemplatePath, 'r') as templateFile: t = Template(templateFile.read()) configContent = t.generate(db_host=host, db_user=user, db_passwd=password, db_type=dbtype, db_driver=driver, db_name=name) # write to dbsetting configFilePath = os.path.join(os.path.dirname(__file__), "dbsetting.py") with open(configFilePath, 'w') as pyFile: pyFile.write(configContent) return True
class KittenGram(JSONRequestHandler): # prepare is called after __init__ is run def prepare(self): tmpl_file = os.path.join(self.get_template_path(),"index.html") if not(os.path.isdir(self.get_template_path())): self.set_status(500) return self.finish("Template path does not exist") with codecs.open(tmpl_file) as f: self.tmpl = Template(f.read()) def get(self, objid, animal): if self.get_argument("format", "").lower() == "json": self.write_json(context.object) else: api_url = context.get_view_url("KittenGram", context.object, animal) ws_url = context.get_ws_url() self.write(self.tmpl.generate(objid=objid, api_url=api_url + '?format=json', ws_url=ws_url, animal=animal, static_url=self.static_url))
async def get(self, path): ''' get method ''' if not path: path = "." if not utils.check_path(path): self.set_status(403) await self.finish("Only relative paths are allowed") return t = Template(utils.get_asset("browse.html")) args = dict( path=path, listing=utils.get_listing(path), format_prefix=utils.format_prefix, stat=stat, get_stat=utils.get_stat, os=os, css=utils.get_asset("bootstrap.css") ) await self.finish(t.generate(**args))
def table_data(*data): # TODO: Relearn tornado templates... with open('templates/table_data.html', 'r', encoding='utf-8') as r: content = r.read() datasets = [] d = {} for handle in data: if isinstance(handle, DatasetObject): v = filter_dataset(handle) # v is a tuple with n entries. datasets.append(v) d['datasets'] = datasets print(d['datasets']) t = Template(content) c = t.generate(**d) with open('tmp.html', 'w', encoding='utf-8') as file: file.write(c.decode('utf-8'))
async def get(self, path): """ get method """ t = Template(utils.get_asset("file.html")) if path is None: self.set_status(404) await self.finish("No such file") return if not utils.check_path(path): self.set_status(403) await self.finish("Only relative paths are allowed") return args = dict( filename=path, jquery=utils.get_asset("jquery.js"), pailer=utils.get_asset("jquery.pailer.js"), css=utils.get_asset("bootstrap.css"), ) await self.finish(t.generate(**args)) return