-
Notifications
You must be signed in to change notification settings - Fork 12
capsul adaptation for populse_db #366
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
Conversation
sapetnioc
left a comment
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.
There is a wrong usage of the Storage API here. I believe this code is not working.
| for config in session.configs(module, env): | ||
| id = "%s-%s" % (config._id, env) | ||
| doc = data[session.collection_name(module)][id] | ||
| items = dict(doc._items()) |
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.
Once get() is called, the value of the document is returned (very likely as a dict in this case). There is no _items() method in Storage API.
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.
Maybe the test if "config_id" in doc: could be appropriate here ?
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.
dict() is useless here.
Personally, I would have directly set doc = data[session.collection_name(module)][id].get() and replace items by doc. But this is no important.
sapetnioc
left a comment
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.
You can merge this PR once you decided what to do (or not to do) with my comments.
| for config in session.configs(module, env): | ||
| id = "%s-%s" % (config._id, env) | ||
| doc = data[session.collection_name(module)][id] | ||
| items = dict(doc._items()) |
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.
dict() is useless here.
Personally, I would have directly set doc = data[session.collection_name(module)][id].get() and replace items by doc. But this is no important.
I'm doing this little PR because I'm not sure!
I'm still not very comfortable with the new populse_db API and I'm wondering if there might be another, more elegant way of doing things here?
We have the config object by doing:
for config in session.configs(module, env) :I haven't found a way to use this object to retrieve the configuration items, so I'm using the
enumerate()function ...Isn't there a better method?
Isn't regression possible?