Skip to content

Commit 9b56281

Browse files
committed
Make --force-import less picky
1 parent 791930c commit 9b56281

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cities_light/management/commands/cities_light.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class Command(BaseCommand):
4949
It is possible to force the download of some files which have not been updated
5050
on the server:
5151
52-
manage.py --force cities15000.txt countryInfo.txt
52+
manage.py --force cities15000 --force countryInfo
5353
5454
It is possible to force the import of files which weren't downloaded using the
5555
--force-import option:
5656
57-
manage.py --force-import cities15000.txt countryInfo.txt
57+
manage.py --force-import cities15000 --force-import country
5858
'''.strip()
5959

6060
logger = logging.getLogger('cities_light')
@@ -110,8 +110,13 @@ def handle(self, *args, **options):
110110
geonames = Geonames(url, force=force)
111111
downloaded = geonames.downloaded
112112

113-
force_import = options['force_import_all'] or \
114-
destination_file_name in options['force_import']
113+
force_import = options['force_import_all']
114+
115+
if not force_import:
116+
for f in options['force_import']:
117+
if f in destination_file_name or f in url:
118+
force_import = True
119+
115120

116121
if downloaded or force_import:
117122
self.logger.info('Importing %s' % destination_file_name)

0 commit comments

Comments
 (0)