Skip to content

Commit

Permalink
Fill gear defaults on a copy
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrussimon committed Nov 7, 2017
1 parent 470fdb8 commit 8bc87c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/jobs/gears.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import

import bson.objectid
import copy
import datetime
from jsonschema import Draft4Validator, ValidationError
import gears as gear_tools
Expand Down Expand Up @@ -130,8 +131,10 @@ def fill_gear_default_values(gear, config_):

if config_ is None:
config_ = {}
else:
config_ = copy.deepcopy(config_)

for k,v in gear['gear'].get('config', {}).iteritems():
for k, v in gear['gear'].get('config', {}).iteritems():
if 'default' in v:
config_.setdefault(k, v['default'])

Expand Down

0 comments on commit 8bc87c5

Please sign in to comment.