• web.py template


    第一次写- -

    web.py的资料还是太少

    不过webpy.org的文档够多了

    不过就是没写

    $def with (var1,var2...)

    必须在第一行啊啊啊啊!

    尼玛被坑了一晚上

    import sys
    sys.path.append("..")
    
    import web
    import dao.HouseDao
    
    
    render = web.template.render('templates/')
    
    class Index:
    	def GET(self):
    		house = dao.HouseDao.get(10,0)
    		title = house.get_field('title')
    		url = house.get_field('url')
    		house = zip(title , url)
    		return render.index(house)
    

      

    $def with (hourse)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    
    ...

    必须要这样= =,不然就是无穷的报错

    Traceback (most recent call last):
    File "E:\Python27\lib\site-packages\web\application.py", line 239, in process
    return self.handle()
    File "E:\Python27\lib\site-packages\web\application.py", line 230, in handle
    return self._delegate(fn, self.fvars, args)
    File "E:\Python27\lib\site-packages\web\application.py", line 420, in _delegate
    return handle_class(cls)
    File "E:\Python27\lib\site-packages\web\application.py", line 396, in handle_class
    return tocall(*args)
    File "E:\1957\demo\src\control\index.py", line 17, in GET
    return render.index('fyh')
    File "E:\Python27\lib\site-packages\web\template.py", line 1017, in __getattr__
    t = self._template(name)
    File "E:\Python27\lib\site-packages\web\template.py", line 1014, in _template
    return self._load_template(name)
    File "E:\Python27\lib\site-packages\web\template.py", line 999, in _load_template
    return Template(open(path).read(), filename=path, **self._keywords)
    File "E:\Python27\lib\site-packages\web\template.py", line 846, in __init__
    code = self.compile_template(text, filename)
    File "E:\Python27\lib\site-packages\web\template.py", line 912, in compile_template
    compiled_code = compile(code, filename, 'exec')
    File "templates\index.html", line 73
    def with (hourse)

    by 1957
  • 相关阅读:
    java8 Date/Time API 新的日期处理工具
    java8 Lambda 表达式和函数式接口快速理解
    java8 新特性精心整理(全)
    Git 从入门到熟练|不敢说精通
    C# Color 列表
    自动控制原理6
    forfiles命令详解
    详解SQLEXPR32_x86_CHS.exe、SQLEXPR_x86_CHS.exe、SQLEXPR_x64_CHS.exe之间的区别
    power disiagner pdb
    vs 中大括号之间垂直虚线显示
  • 原文地址:https://www.cnblogs.com/x1957/p/2809376.html
Copyright © 2020-2023  润新知