You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, because the Django GDAL api uses force_text on the return value of fields, decoding errors can happen as soon as we read it. Right now, in the above code the first try/except catches them and so reports the wrong message to the user.
I'll take a stab at fixing this, this is just to remind me what the problem is.
The text was updated successfully, but these errors were encountered:
This changes the logic for extract and decoding the name from a
feature so that Exceptions are caught more selectively and the right
errors are reported to the user.
Previously, a UnicodeDecodeError could occur when the name field
was read (because internally, the GDAL api uses force_text on
the output) and the code would catch it but instead report that the
name field didn't exist. This was confusing on files with encoding
errors.
Closes#168
This changes the logic for extract and decoding the name from a
feature so that Exceptions are caught more selectively and the right
errors are reported to the user.
Previously, a UnicodeDecodeError could occur when the name field
was read (because internally, the GDAL api uses force_text on
the output) and the code would catch it but instead report that the
name field didn't exist. This was confusing on files with encoding
errors.
Closes#168
This changes the logic for extracting and decoding the name from a
feature so that Exceptions are caught more selectively and the right
errors are reported to the user.
Previously, a UnicodeDecodeError could occur when the name field
was read (because internally, the GDAL api uses force_text on
the output) and the code would catch it but instead report that the
name field didn't exist. This was confusing on files with encoding
errors.
Closes#168
This section: https://github.com/mysociety/mapit/blob/master/mapit/management/commands/mapit_import.py#L217-L230 of the
mapit_import
command tries to extract the name of a feature from the supplied data file, and prints a helpful error if it can't find a name under the field name you specified. Later on, it then tries to decode the name using the encoding you specified.However, because the Django GDAL api uses
force_text
on the return value of fields, decoding errors can happen as soon as we read it. Right now, in the above code the first try/except catches them and so reports the wrong message to the user.I'll take a stab at fixing this, this is just to remind me what the problem is.
The text was updated successfully, but these errors were encountered: