webpy 'builtin_function_or_method' object is not iterable

问题描述

webpy 'builtin_function_or_method' object is not iterable

我准备用webpy做一个网站,现在遇到这个困难,希望知道的帮忙一下,
我的网站结构:
mysite
--site_helper.py
--controllers/index.py
--templates/main/base.html
--templates/main/index.html

site_helper.py
#! /usr/bin/python
#-*- coding:utf-8 -*-
#Filename: site_helper.py

import sys
reload(sys)
sys.setdefaultencoding("utf-8")
"""这是网站的入口文件,用于调动controllers, modules, templates下的内容来服务"""
import web
urls = (
'/?', 'controllers.index.Index', #controllers/index.py
)

#加载render
render = web.template.render
main_render = render(loc='templates/main', base='base', globals=globals)

if name == '__main__':
app = web.application(urls, globals())
app.run()

templates/main/base.html
$def with(page)

title
<br>
#menu{<br>
width:200px;<br>
float:right;<br>
}<br>

$:page

templates/main/index.html
$def with(news)

test

news

$news

controllers/index.py
#! /usr/bin/python
#-*- coding:utf-8 -*-
#Filename: controllers/index.py

import sys

reload(sys)
sys.setdefaultencoding("utf-8")

import site_helper as sher
class Index():
def GET(self):
ss = 'hello news'
return sher.main_render.index(ss) #出错

在我标记出错的那行产生了错误,错误为:'builtin_function_or_method' object is not iterable

时间: 2024-08-30 10:48:53

webpy &amp;#39;builtin_function_or_method&amp;#39; object is not iterable的相关文章

请求-求助啊!!var id=$(this).attr(&amp;amp;#39;id&amp;amp;#39;); 和 $(this).empty(); 怎么结合

问题描述 求助啊!!var id=$(this).attr('id'); 和 $(this).empty(); 怎么结合 已经获得各个id ... $(document).ready(function(){ $('div').click(function(){ var id=$(this).attr('id'); alert(id); //可以得到某个id的值 var aurl=""<%=basePath%>/colV.action""; var ada

javascript-jquery如何设置一个动态创建的 $(&amp;amp;#39;#&amp;amp;#39;).append(&amp;amp;#39;&amp;amp;#39;)中的ID?并利用它

问题描述 jquery如何设置一个动态创建的 $('#').append('')中的ID?并利用它 就比如像这样的: <script type="text/javascript"> var number=0; function next(){ $('#showdata').append('<input class="number_showdata" id="showdataid'+number+'" type="tex

DJANGO问题--Error: ‘ManyRelatedManager’ object is not iterable

http://www.itblah.com/django-error-manyrelatedmanager-object-iterable/ Django: Error: 'ManyRelatedManager' object is not iterable   While trying to iterate through a list of objects in a Django template, I came across this error: "Caught an exception

oc-property &amp;amp;#39;image1&amp;amp;#39; not found on object of type &amp;amp;#39;id&amp;amp;#39;

问题描述 property 'image1' not found on object of type 'id' 自定义cell,想把模型数组里的第一个模型元素的image1属性,赋值给cell的image1属性,报错 property 'image1' not found on object of type 'id',求大神告知 解决方案 没有找到image1这个属性,看下你的代码 解决方案二: 用Xcode4,iOS7以前的SDK编辑使用了iOS7新特性的工程,如果用到了 edgesForEx

python-&amp;amp;#39;GridFS&amp;amp;#39; object has no attribute &amp;amp;#39;find&amp;amp;#39;

问题描述 'GridFS' object has no attribute 'find' 1C File ""E:codetake.py"" line 52 in take for s in fs.find({'packageName':doc['_id']}): AttributeError: 'GridFS' object has no attribute 'find' 请问各位朋友我python中报这个错误是什么原因,该如何解决呢?下面是我的代码:#!/bin

python 出现dict&amp;amp;#39; object has no attribute &amp;amp;#39;key&amp;amp;#39;

问题描述 python 出现dict' object has no attribute 'key' def make_omelet(omelet_type): def get_omelet_ingredients(omelet_name): ingredients={"egg":2,"milk":1} if omelet_name=="cheese": ingredients["cheddar"]=2 elif omelet_

python新手求助-初学者python &amp;amp;#39;str&amp;amp;#39; object has no attribute &amp;amp;#39;vals&amp;amp;#39; 怎么解决啊

问题描述 初学者python 'str' object has no attribute 'vals' 怎么解决啊 代码如下 import sqlite3 def convert(value): if value.startswith('~'): return value.strip('~') if not value: value = '0' return float(value) conn=sqlite3.connect('food.db') curs=conn.cursor() try:

asp.net-用户 &amp;amp;#39;sa&amp;amp;#39; 登录失败。

问题描述 用户 'sa' 登录失败. 用户 'sa' 登录失败. 说明: 执行当前 Web 请求期间,出现未处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: System.Data.SqlClient.SqlException: 用户 'sa' 登录失败. 源错误: 行 36: } 行 37: if (con.State == System.Data.ConnectionState.Closed) 行 38: con.Open(); 行 39:

Unknown column &amp;#39;*&amp;#39; in &amp;#39;field list&amp;#39; 异常解决

在使用Hibernate做持久化的时候,为实体类定义一个与数据表无关的属性. 出现异常如下: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'user0_.authority' in 'field list' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.Native