我有mail.py文件:对象没有属性 - 金字塔
# coding: utf-8
from ..lib.common import *
from ..lib.common import _
from ..lib.forms import *
import os
log = logging.getLogger(__name__)
class mail(BaseHandler):
@view_config(route_name="mail", renderer="mail/mail.mako")
def index(self):
return {
'mail':mail
}
@view_config(route_name="send")
def send(request):
data = request.params['in']
return Response(str(data))
和mail.maco:
## coding: utf-8
<%inherit file="../base.mako" />
<form action="${request.route_url('send')}" method="post">
<input type="text" name="in" size="50">
<input type="submit" value="SEND" >
</form>
我想 '在' 的文字就搞定了。但是,当我按下发送按钮金字塔告诉我错误:
AttributeError: 'mail' object has no attribute 'params'
如果我写
Response('some text')
一切的伟大工程和文字显示,但我想输入的文字。为什么我会得到这个错误?
请修复你的缩进并提供你的错误信息的完整回溯。 – 2012-03-21 18:47:54
@SvenMarnach,对不起。固定。 – 2012-03-21 18:59:59