Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions capsul/engine/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,11 @@ def export_config_dict(self, environment=None):
for module in modules:
mod_conf = {}
for config in session.configs(module, env):
id = "%s-%s" % (config._id, env)
doc = data[session.collection_name(module)][id]
items = dict(doc._items())
Copy link
Collaborator

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.

Copy link
Collaborator

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 ?

Copy link
Collaborator

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.

if "config_id" in items:
items["config_id"] = items["config_id"][: -len(env) - 1]
mod_conf[config._id] = items
id = f"{config._id}-{env}"
doc = data[session.collection_name(module)][id].get()
if "config_id" in doc:
doc["config_id"] = doc["config_id"][: -len(env) - 1]
mod_conf[config._id] = doc
if mod_conf:
env_conf[module] = mod_conf

Expand Down