2
votes

I set LoginHandler like this:

class LoginHandler(BaseHandler):
    def get(self):
        self.render('admin/login.html',footertext='footer text goes here')

but it doesn't work. I also change static_url to static urls in template, but still I have this. Can somebody help me on this?

Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/tornado-4.3-py2.7-linux-x86_64.egg/tornado/web.py", line 1443, in _execute result = method(*self.path_args, **self.path_kwargs)

File "/home/simon/myblog/handlers.py", line 53, in get self.render('admin/login.html',footertext='footer text goes here')

File "/usr/local/lib/python2.7/dist-packages/tornado-4.3-py2.7-linux-x86_64.egg/tornado/web.py", line 699, in render html = self.render_string(template_name, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/tornado-4.3-py2.7-linux-x86_64.egg/tornado/web.py", line 806, in render_string return t.generate(**namespace)

File "/usr/local/lib/python2.7/dist-packages/tornado-4.3-py2.7-linux-x86_64.egg/tornado/template.py", line 345, in generate return execute()

File "admin/login_html.generated.py", line 13, in _tt_execute _tt_tmp = _tt_utf8(True(_tt_tmp)) # admin/login.html:47 (via admin/framework.html:33)

TypeError: 'bool' object is not callable

what is the problem?

1
Looks like an error in your login.html, can you show the code around line 47 of login.html?A. Jesse Jiryu Davis
line 47 on login.htlm is nothing special but a div, i find in framework.html,for which i use for template,line 33 is {% block footer %},but i haven't put sth there.is it to be blame?simonchou
The starcktrace you enclosed show that the error is either in login.html or BaseHandler - show them.kwarunek
in BaseHandler: class BaseHandler(tornado.web.RequestHandler): def get_current_user(self): return self.get_secure_cookie("user") def write_error(self,status_code,**kwargs): self.render("404.html")simonchou
@kwarunek is something wrong with write_error?simonchou

1 Answers

0
votes

From the pattern _tt_tmp = _tt_utf8(True(_tt_tmp)) in the stack trace, I think you've set the autoescape variable to True, which is not a valid value. The autoescape setting must either be None or a function (the default is xhtml_escape). Since autoescape is on by default, you shouldn't need to set it at all; you only need to set it if you need to turn it off or use a non-default escaping function. If you do want to set it explicitly, set it to xhtml_escape since that is the default.