Working on Issue #113 would plane that deals with the sorting of the locations firuging out a way to sort the locations in the right order.
This commit is contained in:
parent
299252c165
commit
9ad8863c58
|
@ -37,10 +37,11 @@ def main(*argv):
|
|||
ambiguous_re.match(identifier),
|
||||
identifier in ambiguous_set,
|
||||
))
|
||||
print len(locations), ' *'[disambiguate], identifier,
|
||||
location_split = identifier.split('-')
|
||||
print(location_split)
|
||||
if disambiguate:
|
||||
changes = True
|
||||
print u'→'.encode('utf-8'),
|
||||
#print u'→'.encode('utf-8'),
|
||||
by_region = defaultdict(list)
|
||||
for location in locations:
|
||||
if location.region:
|
||||
|
@ -54,26 +55,26 @@ def main(*argv):
|
|||
# No change
|
||||
new_identifier = identifier
|
||||
if len(region_locations) == 1:
|
||||
location = region_locations[0]
|
||||
location = region_locations[0]
|
||||
# The region was enough
|
||||
print new_identifier,
|
||||
location.identifier = new_identifier
|
||||
#print(new_identifier)
|
||||
location.identifier = new_identifier
|
||||
else:
|
||||
# Need to number the locations :(
|
||||
for i, location in enumerate(region_locations, start=1):
|
||||
numbered_identifier = '%s-%s' % (new_identifier, i)
|
||||
print numbered_identifier,
|
||||
# print numbered_identifier,
|
||||
location.identifier = numbered_identifier
|
||||
print
|
||||
print(location)
|
||||
|
||||
if changes:
|
||||
if argv and argv[0] == '--commit':
|
||||
session.commit()
|
||||
print 'Committed'
|
||||
print('Committed')
|
||||
else:
|
||||
print 'Run with --commit to commit changes'
|
||||
print('Run with --commit to commit changes')
|
||||
else:
|
||||
print 'No changes needed'
|
||||
print('No changes needed')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue