-
Couldn't load subscription status.
- Fork 1.2k
to_db_fields fix #1553
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
to_db_fields fix #1553
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @elephanter! Does this PR mean that SomeDoc.objects.only('some_field_thats_not_on_the_doc') doesn't fail anymore?
mongoengine/queryset/base.py
Outdated
| for field in fields: | ||
| try: | ||
| field = '.'.join(f.db_field for f in | ||
| field = '.'.join(f.db_field if not isinstance(f, six.string_types) else f for f in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could re-write it without a double-negative, i.e. f if isinstance(f, six,string_types) else f.db_field
mongoengine/queryset/base.py
Outdated
| for subdoc in subclasses: | ||
| try: | ||
| subfield = '.'.join(f.db_field for f in | ||
| subfield = '.'.join(f.db_field if not isinstance(f, six.string_types) else f for f in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
|
Problem was in MapField, when trying to get value from it by key. (DictField will work correctly as I know) I think there was another error, where we requesting some index in array, like
|
|
Right, I was just asking if a case that should fail doesn't anymore (which is my hunch). If that's the case, we can't merge this PR. Just to reiterate, I believe |
|
ok. if that test should fail and do not fail now - travis tests must fail. Maybe I don't understand you quite well |
|
Hi @elephanter! Sorry for the delay and the confusion. My hunch was wrong and, after a closer inspection of your PR, everything looks good. Thanks again! |
#1275 fix with tests