Print debug only if debug is True
This commit is contained in:
parent
34a839422e
commit
20285f20c5
1 changed files with 5 additions and 3 deletions
|
@ -418,7 +418,7 @@ class Command(BaseCommand):
|
||||||
print("Total rows = %s, error rows = %s" % (total, error_row_count))
|
print("Total rows = %s, error rows = %s" % (total, error_row_count))
|
||||||
|
|
||||||
|
|
||||||
def handle_object_dict(object_dict, model_name):
|
def handle_object_dict(object_dict, model_name, debug=False):
|
||||||
if model_name == 'Resource':
|
if model_name == 'Resource':
|
||||||
object_dict['url'] = object_dict['url'].strip("#")
|
object_dict['url'] = object_dict['url'].strip("#")
|
||||||
for i in ['PEGASuS_Check_map_with_author', 'gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team', 'inventory']:
|
for i in ['PEGASuS_Check_map_with_author', 'gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team', 'inventory']:
|
||||||
|
@ -432,12 +432,14 @@ def handle_object_dict(object_dict, model_name):
|
||||||
for f in connected_fields:
|
for f in connected_fields:
|
||||||
for k, v in f.items():
|
for k, v in f.items():
|
||||||
if k in object_dict:
|
if k in object_dict:
|
||||||
print('Getting %s of %s' % (k, object_dict[k]))
|
if debug:
|
||||||
|
print('Getting %s of %s' % (k, object_dict[k]))
|
||||||
if object_dict[k] == '':
|
if object_dict[k] == '':
|
||||||
object_dict[k] = 0
|
object_dict[k] = 0
|
||||||
object_dict[k] = v.objects.get(id=int(object_dict[k]))
|
object_dict[k] = v.objects.get(id=int(object_dict[k]))
|
||||||
if 'mother_range' in object_dict:
|
if 'mother_range' in object_dict:
|
||||||
print('Getting mother_range of %s' % object_dict['mother_range'])
|
if debug:
|
||||||
|
print('Getting mother_range of %s' % object_dict['mother_range'])
|
||||||
if object_dict['mother_range'] == '':
|
if object_dict['mother_range'] == '':
|
||||||
object_dict['mother_range'] = 0
|
object_dict['mother_range'] = 0
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue