2
정의되지 않은 2 방법파일론 마코, I 정의 제어기 가변
foobar.py :
class foo(self):
c.help_text = 'help'
return render('/index.html')
class bar(self):
return render('/index.html')
된 index.html :
${c.help_text}
이 나에게 오류를 범 ==> AttributeError : 'ContextObj'객체에 'help_text'속성이 없습니다.
일부 mako 문서를 읽은 후에 시도합니다.
% if c.help_text is UNDEFINED:
foo
% else:
${c.help_text}
% endif
또한 오류가 발생합니다. 그럼 내 development.ini에, 내가 넣어 :
mako.strict_undefined = false
[app:main]
후이 여전히 나에게 오류를 제공 ==> AttributeError : 'ContextObj'개체가 어떤 속성이없는 'help_text'
이 질문 참조 : http://stackoverflow.com/questions/12006720/pylons-mako-how-to-check-if-variable-exist-or-not –