File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -519,11 +519,19 @@ def _load_one_csv_file(name: str) -> int:
519519
520520 click .echo ('- %s %s' % (org_name , len (records )))
521521
522+ # default org extras
523+ org_extras = [
524+ 'owner_org' ,
525+ 'owner_org_title'
526+ ]
522527 if 'csv_org_extras' in chromo :
523- # remove 'csv_org_extras' fields from records
524- for r in records :
525- for e in chromo ['csv_org_extras' ]:
526- del r [e ]
528+ org_extras += chromo ['csv_org_extras' ]
529+ # remove any org extras
530+ for r in records :
531+ for e in org_extras :
532+ if e not in r :
533+ continue
534+ del r [e ]
527535
528536 offset = 0
529537 while offset < len (records ):
@@ -624,6 +632,7 @@ def _write_one_csv(lc: LocalCKAN,
624632 chromo ['resource_name' ], pkg ['owner_org' ]))
625633 continue
626634
635+ # default org extras
627636 org_extras = {
628637 'owner_org' : pkg ['owner_org' ],
629638 'owner_org_title' : pkg ['org_title' ],
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def csv_data_batch(csv_path: str,
4848 if f ['datastore_type' ] != 'text' ]
4949
5050 for row_dict in csv_in :
51- owner_org = row_dict .pop ('owner_org' )
51+ owner_org = row_dict .pop ('owner_org' , None )
5252 if owner_org != current_owner_org :
5353 if records :
5454 yield (current_owner_org , records )
You can’t perform that action at this time.
0 commit comments