Skip to content
Snippets Groups Projects
Commit 4095c5eb authored by DESPRES Damien's avatar DESPRES Damien
Browse files

fix #14076

parent 880ee41c
Branches
Tags
1 merge request!26fix #14076
Pipeline #34132 passed
...@@ -29,7 +29,7 @@ def translate_content_type( content_type ): ...@@ -29,7 +29,7 @@ def translate_content_type( content_type ):
return output return output
def protocol_to_formats_and_services( links ): def protocol_to_formats_and_services( links, inRecord ):
output = links.copy() output = links.copy()
...@@ -47,6 +47,9 @@ def protocol_to_formats_and_services( links ): ...@@ -47,6 +47,9 @@ def protocol_to_formats_and_services( links ):
elif link['protocol'] == 'KML': elif link['protocol'] == 'KML':
output[k]['formats'] = ['KML'] output[k]['formats'] = ['KML']
output[k]['service'] = 'KML' output[k]['service'] = 'KML'
elif link['protocol'] == 'WS' and inRecord['type'] == 'nonGeographicDataset':
output[k]['formats'] = ['JSON', 'CSV']
output[k]['service'] = 'WS'
elif link['protocol'] == 'WS': elif link['protocol'] == 'WS':
output[k]['formats'] = ['JSON', 'ShapeFile', 'CSV'] output[k]['formats'] = ['JSON', 'ShapeFile', 'CSV']
output[k]['service'] = 'WS' output[k]['service'] = 'WS'
...@@ -67,7 +70,7 @@ def protocol_to_formats_and_services( links ): ...@@ -67,7 +70,7 @@ def protocol_to_formats_and_services( links ):
return output return output
def fix_links( links, credentials=None ): def fix_links( links,inRecord, credentials=None ):
fixed_links = links.copy() fixed_links = links.copy()
...@@ -180,7 +183,7 @@ def fix_links( links, credentials=None ): ...@@ -180,7 +183,7 @@ def fix_links( links, credentials=None ):
fixed_links[k]['url'] = link['url'].split('?')[0] fixed_links[k]['url'] = link['url'].split('?')[0]
return protocol_to_formats_and_services(fixed_links) return protocol_to_formats_and_services(fixed_links,inRecord)
if __name__ == '__main__': if __name__ == '__main__':
...@@ -285,5 +288,5 @@ if __name__ == '__main__': ...@@ -285,5 +288,5 @@ if __name__ == '__main__':
} }
] ]
fixed_links = fix_links(links) fixed_links = fix_links(links,{})
pprint(fixed_links) pprint(fixed_links)
...@@ -161,7 +161,7 @@ def process_record( in_record, working_directory, credentials ): ...@@ -161,7 +161,7 @@ def process_record( in_record, working_directory, credentials ):
if 'link' in out_record['metadata-fr'].keys(): if 'link' in out_record['metadata-fr'].keys():
del out_record['metadata-fr']['link'] del out_record['metadata-fr']['link']
tmp = list_to_dictlist(in_record['link'], 'link')#links tmp = list_to_dictlist(in_record['link'], 'link')#links
out_record['metadata-fr']['link'] = enrich_links( fix_links(tmp, credentials), credentials, working_directory ) out_record['metadata-fr']['link'] = enrich_links( fix_links(tmp, in_record, credentials), credentials, working_directory )
if 'userinfo' in out_record['metadata-fr'].keys(): if 'userinfo' in out_record['metadata-fr'].keys():
del out_record['metadata-fr']['userinfo'] del out_record['metadata-fr']['userinfo']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment