Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Check if the returned name is already Unicode.

Django 1.5 (specifically 9a2bceed) changes the behaviour of DataSource
feature lookup, returning a unicode string rather than the str it did
previously. So check whether we've been given a unicode string before
trying to convert it.
  • Loading branch information...
commit e639caa3fe2968d63338f6dfacba35252f7dcee9 1 parent 89f5b53
@dracos dracos authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 mapit/management/commands/mapit_UK_import_boundary_line.py
View
4 mapit/management/commands/mapit_UK_import_boundary_line.py
@@ -43,7 +43,9 @@ def handle_label(self, filename, **options):
ds = DataSource(filename)
layer = ds[0]
for feat in layer:
- name = unicode(feat['NAME'].value, 'iso-8859-1')
+ name = feat['NAME'].value
+ if not isinstance(name, unicode):
+ name = name.decode('iso-8859-1')
name = re.sub('\s*\(DET( NO \d+|)\)\s*(?i)', '', name)
name = re.sub('\s+', ' ', name)

0 comments on commit e639caa

Please sign in to comment.
Something went wrong with that request. Please try again.