librelist archives

« back to archive

Flask + Flask-Login == TypeError?

Flask + Flask-Login == TypeError?

From:
Tark
Date:
2012-11-10 @ 19:14
Hello!
I am newbie in Flask. I try to create test application with admin page. 
It’s all works perfectly except admin login page.
I set app.config['SECRET_KEY'] and app.config['SERVER_NAME'] but...
When I check http://flask.tark:5000/admin/ I get this error:

TypeError
TypeError: character mapping must return integer, None or unicode
Traceback (most recent call last)
File "F:\Python\lib\site-packages\flask\app.py", line 1701, in __call__
return self.wsgi_app(environ, start_response)
File "F:\Python\lib\site-packages\flask\app.py", line 1685, in wsgi_app
with self.request_context(environ):
File "F:\Python\lib\site-packages\flask\ctx.py", line 274, in __enter__
self.push()
File "F:\Python\lib\site-packages\flask\ctx.py", line 238, in push
self.session = self.app.open_session(self.request)
File "F:\Python\lib\site-packages\flask\app.py", line 792, in open_session
return self.session_interface.open_session(self, request)
File "F:\Python\lib\site-packages\flask\sessions.py", line 191, in open_session
secret_key=key)
File "F:\Python\lib\site-packages\werkzeug\contrib\securecookie.py", line 
312, in load_cookie
return cls.unserialize(data, secret_key)
File "F:\Python\lib\site-packages\werkzeug\contrib\securecookie.py", line 
259, in unserialize
mac = hmac(secret_key, None, cls.hash_method)
File "F:\Python\lib\hmac.py", line 133, in new
return HMAC(key, msg, digestmod)
File "F:\Python\lib\hmac.py", line 72, in __init__
self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode

If I don’t use session, I get 404. If use – error.
What, what, what is wrong with this???

bash.py (application) - http://pastebin.com/bs1kLRnk
helpers/__init__.py - http://pastebin.com/P59m5PnF
views.py - http://pastebin.com/ZQPG3kQ0
admin.py - http://pastebin.com/LmPPQ92E