coleifer / flask-peewee

flask integration for peewee, including admin, authentication, rest api and more
http://flask-peewee.readthedocs.org/
MIT License
776 stars 181 forks source link

Unicode object must be encoded #143

Open btnpushnmunky opened 10 years ago

btnpushnmunky commented 10 years ago

Maybe you've seen this before, but I'm getting the following error when setting up a user:

Python 3.4.1 (default, May 19 2014, 13:10:29) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin Type "help", "copyright", "credits" or "license" for more information.

python Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined from app import auth admin = auth.User(username='admin', email= ... '', active=True, admin=True) admin.set_password( ... 'admin') Traceback (most recent call last): File "", line 2, in File "/Users/dross/Projects/timer/env/lib/python3.4/site-packages/flask_peewee/auth.py", line 22, in set_password self.password = make_password(password) File "/Users/dross/Projects/timer/env/lib/python3.4/site-packages/flask_peewee/utils.py", line 133, in make_password salt = get_hexdigest(str(random.random()), str(random.random()))[:5] File "/Users/dross/Projects/timer/env/lib/python3.4/site-packages/flask_peewee/utils.py", line 130, in get_hexdigest return sha1(salt + raw_password).hexdigest() TypeError: Unicode-objects must be encoded before hashing

sc0tt commented 10 years ago

Related? https://github.com/coleifer/flask-peewee/pull/81

I don't think a new version has been released with this change though.

btnpushnmunky commented 10 years ago

Installing directly from Github with pip works, so I believe @sc0tt is correct.