Skip to content
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

Raise exception if mongo URI doesn't contain DB name #217

Closed
bkabrda opened this issue Mar 18, 2016 · 1 comment
Closed

Raise exception if mongo URI doesn't contain DB name #217

bkabrda opened this issue Mar 18, 2016 · 1 comment
Labels
type: enhancement Enhancement update for old feature
Milestone

Comments

@bkabrda
Copy link
Contributor

bkabrda commented Mar 18, 2016

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.

[1]

conn['db'] = uri_dict['database']

@losintikfos
Copy link
Member

Thanks @bkabrda this will be addressed in relation with #98. Can you please make pull request.

@lafrech lafrech added this to the 0.8 milestone Mar 20, 2016
@lafrech lafrech added the type: enhancement Enhancement update for old feature label Mar 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Enhancement update for old feature
Projects
None yet
Development

No branches or pull requests

3 participants