Trying that will raise:
Traceback (most recent call last):
File "", line 1, in
TypeError: Item in ``from list'' not a string
from flask.ext.wtf import Form
works fine. This is using Flask 0.9, WTForms 1.0.2 and Flask-WTF 0.8 on Debian 6 with python 2.6.
from flask.ext.wtf import *
on Windows 7 with Python 2.7 does work, though.
Right, so in case anyone else ran into this, I had to modify flask_wtf/init.py at line 51 with:
__all__ += [str(v) for v in validators.__all__]
__all__ += [str(f) for f in (fields.__all__ if hasattr(fields, '__all__') else fields.core.__all__)]
__all__ += [str(w) for w in (widgets.__all__ if hasattr(widgets, '__all__') else widgets.core.__all__)]
Apparently, all those WTForms modules have the statement
from __future__ import unicode_literals
which was making all contain unicode strings instead of plain str. It seems importing doest not work well with unicode strings.
My solution is probably not the best, so if anyone has any input on this I'd appreciate it.
Why did we close this issue? I still have this issue. Can we just fix it?
I think this is important for all users.
Sorry, you're right. Not exactly sure why I decided to close the issue. You can just go ahead and apply the change I mentioned if you want.
Thank you, rhyek.
As you already have solution for this issue, can we just fix it and merge it into mainline?
Or, I am sorry did I miss something?
Force unicode literals to str as per #50.
Implements str cast as suggested by rhyek in issue #50
Should be fixed. Thanks for the suggestions and sorry for the delay.