diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-26 22:52:23 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-10-26 22:52:23 +0200 | 
| commit | d2ae0229edb74a1d19c5830772bfa3f0dc59f441 (patch) | |
| tree | ea9dd4b55f4811f6412e0c2a3ee716fd04f67163 | |
| parent | 46a7d6cea36c6dfe516e52c9b19309472f162c17 (diff) | |
| download | Ishtar-d2ae0229edb74a1d19c5830772bfa3f0dc59f441.tar.bz2 Ishtar-d2ae0229edb74a1d19c5830772bfa3f0dc59f441.zip | |
Fix tests for towns
| -rw-r--r-- | ishtar_common/fixtures/test_towns.json | 2 | ||||
| -rw-r--r-- | ishtar_common/management/commands/import_geofla_csv.py | 13 | 
2 files changed, 7 insertions, 8 deletions
| diff --git a/ishtar_common/fixtures/test_towns.json b/ishtar_common/fixtures/test_towns.json index a88ca6476..d34c10411 100644 --- a/ishtar_common/fixtures/test_towns.json +++ b/ishtar_common/fixtures/test_towns.json @@ -7,7 +7,6 @@              "name": "PARIS-1ER-ARRONDISSEMENT",               "center": "POINT (599976.9837326267734170 2429351.2226647692732513)",               "surface": 1810000,  -            "canton": null,               "numero_insee": "75101"          }      },  @@ -19,7 +18,6 @@              "name": "LILLE",               "center": "POINT (650348.5204579939600080 2626592.6267738011665642)",               "surface": 34990000,  -            "canton": null,               "numero_insee": "59350"          }      } diff --git a/ishtar_common/management/commands/import_geofla_csv.py b/ishtar_common/management/commands/import_geofla_csv.py index b7cb2b604..80e10bc81 100644 --- a/ishtar_common/management/commands/import_geofla_csv.py +++ b/ishtar_common/management/commands/import_geofla_csv.py @@ -18,6 +18,7 @@  # See the file COPYING for details.  import csv +import sys  from django.core.management.base import BaseCommand  from django.contrib.gis.geos import GEOSGeometry, Point @@ -36,14 +37,14 @@ class Command(BaseCommand):      def handle(self, *args, **options):          csv_file = options['csv_file'] -        self.stdout.write('* Opening file {}\n'.format(csv_file)) +        sys.stdout.write('* Opening file {}\n'.format(csv_file))          default_year = options['year']          nb_created, nb_changed = 0, 0          with open(csv_file, 'rb') as csvfile:              reader = csv.DictReader(csvfile)              for idx, row in enumerate(reader): -                self.stdout.write('Processing town %d.\r' % (idx + 1)) -                self.stdout.flush() +                sys.stdout.write('Processing town %d.\r' % (idx + 1)) +                sys.stdout.flush()                  num_insee = row['INSEE_COM']                  if len(num_insee) < 5:                      num_insee = '0' + num_insee @@ -77,9 +78,9 @@ class Command(BaseCommand):                      if not created:                          nb_changed += 1                      town.save() -        self.stdout.write('\n* {} town created'.format(nb_created)) -        self.stdout.write('\n* {} town changed\n'.format(nb_changed)) -        self.stdout.flush() +        sys.stdout.write('\n* {} town created'.format(nb_created)) +        sys.stdout.write('\n* {} town changed\n'.format(nb_changed)) +        sys.stdout.flush() | 
