-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
QuerySelectField returning ValueError: too many values to unpack (expected 2) #9
Comments
I don't know how to fix it properly, because I don't understand the change (zzzeek/sqlalchemy@50d9f16#diff-f1dd179c3cad67b54ed3deb8e6f6fa6b) but if anyone else comes across this error before it is corrected I did this: Edited wtforms_sqlalchemy/fields.py and changed line 189 from |
You're a day ahead of me, @tjcim, good catch! I also noticed the problem but didn't figure it out until today. Currently my solution is to keep SQLAlchemy below 1.2 but that's not a preferable solution long term. Someone more familiar with the wtforms codebase (@pawl, @prencher, @davidism?) might have a better idea of how to fix it, but it seem like one possible solution would be to modify def get_pk_from_identity(obj):
cls, key = identity_key(instance=obj)
return ':'.join(text_type(x) for x in key) to somehow include the identity_token in its return value? Maybe like so def get_pk_from_identity(obj):
cls, key, token = identity_key(instance=obj)
return ':'.join("{}-{}".format(text_type(x), token) for x in key) But again I don't know enough of wtforms internals to know where this kind of a change would cause problems |
#10 resolves this issue and is backwards compatible with older versions of SQLAlchemy |
@fuhrysteve - What is the advantage of doing I am trying to get better, and was just curious what the advantages are. |
@tjcim Well for starters,
See this for example:
|
@fuhrysteve - yup, that makes sense. Thank you. |
Also, if this API was unstable in the past, there's no reason it can't change again in the future, so the best we can do is assume we'll only get more arguments appended to the list as opposed to prepended. (That's the reasoning behind the PR we did with tshirtman) |
I'd like this to be fixed soon, too. The README says that it's looking for a new maintainer, so I've emailed offering to maintain the project. Regardless of if that ends up being the case, it looks like progress is being made on getting this issue fixed, per @davidism in pallets-eco/wtforms#373 (comment) |
What README says that? Please don't contact the old WTForms maintainers, they have moved on and will just be confused if they get more people pinging them. Anyway, this is an issue with WTForms, pallets-eco/wtforms#373, so closing here. |
This project's readme states it's looking for a maintainer.
If that's not the case, then the README is incorrect. I have a vested interest in seeing this issue fixed, so I had taken steps I thought would ensure a path to a fix. I'm all for having one spot to track the issue, so if you think pallets-eco/wtforms#373 is the best place to track it, then I don't disagree. As a heads up in case you missed it, #10 has a fix for this issue, though I know there were a couple of other solutions presented in pallets-eco/wtforms#373. |
Oh huh, didn't even notice this was the WTForms-SQLAlchemy repo, thought it was the Flask-WTF one. Is there a reason you're using this over WTForms-Alchemy, which has been maintained more actively? |
Historical reasons, probably. I don't use the this library directly, but projects that I maintain at work use wtforms and, by extension (hah!), wtforms-sqlalchemy since it's bundled in with wtforms. I discovered wtforms-alchemy only recently and haven't really had a chance to look at it. If it's a drop-in replacement for wtforms-sqlalchemy then I'm fine using either one. Though, if you want to deprecate wtforms-sqlalchemy, shouldn't wtforms include/reference wtforms-alchemy instead? |
It's not bundled in WTForms. It's that part of WTForms extracted, since WTForms was going to remove it. |
I'm relying on the most current version of wtforms listed on pypi, 2.1, but I hear that's another issue you're working on. Looks like kvesteri/wtforms-alchemy#128 has already identified and fixed the sqlalchemy issue, I'll have to look more seriously into switching libraries, then. Thanks for your explanations and suggestions. |
Going to fix this here and in WTForms (for now, it's going away in WTForms eventually). I was definitely confused about which project was which here. This or WTForms-Alchemy should have the SQLAlchemy part of WTForms. |
@davidism this message was showed in my app after tests. |
This seems to be fixed in master but the fix does not seem to be part of any release, yet. @davidism When is the next release planned? |
Do not assume not-nullable means required for Boolean columns
…s_sqlalchemy by wtforms_alchemy
Environment
Python 3.6.3
How to recreate:
app.py
templates/index.html
The text was updated successfully, but these errors were encountered: