You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this just ate ~2 hours of my life and although it's entirely my fault (the documentation does say "Note that database name from uri has priority over name."), I think it'd make sense to raise exception if no database name is provided in the URI.
If one doesn't provide database name in URI, one ends with a misleading error saying TypeError: name must be an instance of basestring somewhere in PyMongo. My proposal is to raise exception here [1] if uri_dict['database'] is None. AFAICS flask-mongoengie doesn't provide any (official) API to (re)set the DB name and since it doesn't work properly without DB name, then this should be considered error and not allowed (e.g. by raising exception, as I propose).
If you think this is ok, I'll be glad to submit a PR.
So this just ate ~2 hours of my life and although it's entirely my fault (the documentation does say "Note that database name from uri has priority over name."), I think it'd make sense to raise exception if no database name is provided in the URI.
If one doesn't provide database name in URI, one ends with a misleading error saying
TypeError: name must be an instance of basestring
somewhere in PyMongo. My proposal is to raise exception here [1] ifuri_dict['database']
isNone
. AFAICS flask-mongoengie doesn't provide any (official) API to (re)set the DB name and since it doesn't work properly without DB name, then this should be considered error and not allowed (e.g. by raising exception, as I propose).If you think this is ok, I'll be glad to submit a PR.
[1]
flask-mongoengine/flask_mongoengine/__init__.py
Line 94 in ec5d867
The text was updated successfully, but these errors were encountered: