【发布时间】:2016-01-14 04:48:53
【问题描述】:
我有一个来自 mysql 查询的列表,我试图在我的瓶子网站中返回该列表。这可能吗?这是我所拥有的:
def create_new_location():
kitchen_locations = select_location()
return template('''
% for kitchen_location in {{kitchen_locations}}:
<a href="/{{kitchen_location}}/">{{kitchen_location}} Kitchen</a>
<br/>
% end''',kitchen_locations=kitchen_locations)
这是我得到的错误。
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/bottle.py", line 862, in _handle
return route.call(**args)
File "/usr/local/lib/python2.7/site-packages/bottle.py", line 1732, in wrapper
rv = callback(*a, **ka)
File "index.py", line 32, in create_new_location
</form>''',kitchen_locations=kitchen_locations)
File "/usr/local/lib/python2.7/site-packages/bottle.py", line 3609, in template
return TEMPLATES[tplid].render(kwargs)
File "/usr/local/lib/python2.7/site-packages/bottle.py", line 3399, in render
self.execute(stdout, env)
File "/usr/local/lib/python2.7/site-packages/bottle.py", line 3386, in execute
eval(self.co, env)
File "<string>", line 6, in <module>
TypeError: unhashable type: 'set'
【问题讨论】:
-
不,那是不可能的
-
您遇到了什么错误?
-
我本质上是想显示一个 mysql 查询并在每个项目上放置一个链接。
标签: mysql python-2.7 bottle