base adresse: adapt to postcode and city now being a list in streets dumps (#42608)
gitea-wip/passerelle/pipeline/head There was a failure building this commit Details
gitea/passerelle/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Thomas NOËL 2020-05-07 10:54:23 +02:00
parent 2c365d4c8f
commit 43a8f8d3c2
2 changed files with 5 additions and 4 deletions

View File

@ -367,11 +367,12 @@ class BaseAdresse(BaseResource):
line = _not_found = object()
for line in ban_file:
street_info = json_loads(line)
if isinstance(street_info['postcode'], list):
street_info['postcode'] = six.text_type(street_info['postcode'][0])
if street_info['type'] == 'street' and street_info['postcode'].startswith(zipcodes):
if type(street_info['citycode']) is list:
street_info['citycode'] = six.text_type(street_info['citycode'][0])
if type(street_info['name']) is list:
street_info['name'] = six.text_type(street_info['name'][0])
for key in ('citycode', 'name', 'city'):
if isinstance(street_info[key], list):
street_info[key] = six.text_type(street_info[key][0])
StreetModel.objects.update_or_create(
citycode=street_info['citycode'],
name=street_info['name'][:150],

Binary file not shown.