-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PasswordField does not seem to work with Postgres #766
Comments
Thanks :) |
Same code, with updated peewee:
Missing unittests in Postgres? :) |
(I can't reopen the issue, dunno why…) |
I'm not sure what's going on exactly. Having trouble getting |
Thanks for looking into this @coleifer :) I'm just running the snippet from #766 (comment) (I'm on IRC if it helps debugging). |
This diff fixes my usecase: diff --git a/playhouse/fields.py b/playhouse/fields.py
index fcebae7..bfa2d90 100644
--- a/playhouse/fields.py
+++ b/playhouse/fields.py
@@ -47,7 +47,7 @@ if hashpw and gensalt:
return hashpw(password, self) == self
- class PasswordField(TextField):
+ class PasswordField(BlobField):
def __init__(self, iterations=12, *args, **kwargs):
if None in (hashpw, gensalt):
raise ValueError('Missing library required for PasswordField: bcrypt') Basically, the issue seems to be that we are sending bytes to a Text field in Postgres. |
Ah, now I know why tests passe even without the fix: they are never ran with postgres… Is there a reason for that? |
This also makes the tests be ran with postgres.
Fix PasswordField on postgres (fix #766)
Fails with this traceback:
The text was updated successfully, but these errors were encountered: