tulsawebdevs / django-multi-gtfs

Django app to import and export General Transit Feed Specification (GTFS)
http://tulsawebdevs.org/
Apache License 2.0
50 stars 32 forks source link

Handle quotation marks #64

Closed jclgoodwin closed 6 years ago

jclgoodwin commented 6 years ago

The trips.txt file in this feed https://www.transportforireland.ie/transitData/google_transit_expressbus.zip has some odd lines like

46-860-y11-1,"Mo-Fr#1","33.Mo-Fr.46-860-y11-1.2.I","46-860-y11-1.2.I","Aston Quay, stop 4720", "1"

The extra space means "1" is used as the direction_id, which causes an error (DataError: value too long for type character varying(1)).

jwhitlock commented 6 years ago

I think the solution is to enable the skipinitialspace behavior of the CSV reader. In models/base.py:

csv_reader = reader(txt_file, skipinitialspace=True)

With this change, I can import that feed.

jwhitlock commented 6 years ago

Fixed by #68