-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support for Mongoengine in V2.0 #2611
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
base: master
Are you sure you want to change the base?
Conversation
Only known Problem yet is with the Widgets, but that could be related to an outdated wtforms version. Also waiting for the tests. |
Note: you may want to run the style tests before making the commit (they auto-fix the code style). I believe it can be done via |
@@ -73,16 +73,16 @@ def create_ajax_loader(model, name, field_name, opts): | |||
prop = getattr(model, field_name, None) | |||
|
|||
if prop is None: | |||
raise ValueError('Model %s does not have field %s.' % (model, field_name)) | |||
raise ValueError(f'Model {model} does not have field {field_name}.' % (model, field_name)) |
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.
I think you forgot to remove the %
part 😅
(It may be technically valid code, but there's going to be a runtime error here unless model
and/or field_name
contain the matching amount of %s
placeholders 😆)
|
Oh thanks, this command changed a lot :) |
About the last Tests, Typing, my guess would be to change the requirements/typing.in to add mongoengine? |
I imagine you need to add (Or possibly |
Yep @LeXofLeviafan is right - if we're adding mongoengine back, we need to add it to our dependency files. This can be a bit of a pain because of how we/pip manages them across multiple files (and probably a good incentive to switch to something more like Let me know if you need a hand and I can try to help (/work out exactly what to do). |
So… any news on this yet? |
If someone could help me with the final check would be nice. Don't want to break something. Then everything would be done :) |
Samuel, can you update or tell us how to update the dependencies for type checking? or can I just try to add mongoengine to |
@samuelhwilliams I believe this was a question for you 😅 @ElLorans based on the comment within that file, the correct answer appears to be "place |
Argh very sorry - thank you for the nudge. Let me give it a go now - it's quite awkward at the moment to get all of the versions of things in different files compatible. More justification for us/me to switch us over to uv ASAP, probably. |
re: type hints, this issue on mongoengine suggests that the package doesn't really have type hinting support. It mentions an alternative, We might want to just disable type hinting on the mongoengine (for now / forever) package by adding it to the In this case no updates will be needed to the requirements files so avoids that sometimes-painful step. But for future reference the principle is vaguely:
|
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.
This will also need some amount of test coverage when you get happy with the functionality :)
try: | ||
import mongoengine | ||
except ImportError: | ||
raise Exception("Please install mongoengine in order to use mongoengine backend") |
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.
Please can we copy the error format from other extensions, which will include adding a reference to flask-admin[mongoengine]
- and setting that up as an extra in pyproject.toml
.
Thanks to @karpitsky this brings back the support for Mongoengine, but without the dependency of flask-mongoengine.
Reference: #2541