camelot-project / frontend

The frontend: The web-facing server software for CAMELOT
BSD 3-Clause "New" or "Revised" License
2 stars 14 forks source link

Fix bad characters in column names #96

Closed keflavich closed 9 years ago

keflavich commented 9 years ago

Javascript calls can't handle characters like []^/ in column names, so the form would crash if these were used.

keflavich commented 9 years ago

@snlongmore this should fix your issue

snlongmore commented 9 years ago

@keflavich I just tried to upload the same file to the heroku server. The attached screen shot shows that the script is doing something the dodgy characters (i.e. there are no "[]" in the file column name bit). However, I still get the same error.

screen shot 2015-05-26 at 14 06 44

keflavich commented 9 years ago

The corresponding log entries are:

2015-05-26T13:05:39.247025+00:00 heroku[router]: at=info method=POST path="/set_columns/snl_swinbank_12.csv" host=camelot-project.herokuapp.com request_id=2f82e23a-c10d-4265-8e83-f3ced03e7de5 fwd="150.204.197.25" dyno=web.1 connect=2ms service=24ms status=500 bytes=456
2015-05-26T13:05:39.233421+00:00 app[web.1]: DEBUG: Parsing column data. [upload_form]
2015-05-26T13:05:39.229845+00:00 app[web.1]: DEBUG: Beginning set_columns. [upload_form]
2015-05-26T13:05:39.234663+00:00 app[web.1]: DEBUG: Looping through form items. [upload_form]
2015-05-26T13:05:39.235335+00:00 app[web.1]: DEBUG: Created mapping. [upload_form]
2015-05-26T13:05:39.231101+00:00 app[web.1]: DEBUG: Reading table snl_swinbank_12.csv [upload_form]
2015-05-26T13:05:39.234339+00:00 app[web.1]: DEBUG: form: ImmutableMultiDict([('ObsSim', u'IsObserved'), ('name_units', u''), ('Rpc', u'Radius'), ('Email', u's.n.longmore@ljmu.ac.uk'), ('adsid', u'2010Natur.464..733S'), ('ID', u'IDs'), ('GalExgal', u'IsExtragalactic'), ('SurfDensMsunpc2', u'SurfaceDensity'), ('ID_units', u''), ('Username', u'MarkSwinbank'), ('name', u'Ignore'), ('Rpc_units', u'pc'), ('Vkms', u'VelocityDispersion'), ('Vkms_units', u'km/s'), ('SurfDensMsunpc2_units', u'Msun/pc^2'), ('doi', u'10.1038/nature08880')]) [upload_form]
2015-05-26T13:05:39.235004+00:00 app[web.1]: DEBUG: Looping through column_data. [upload_form]
2015-05-26T13:05:39.235642+00:00 app[web.1]: DEBUG: Further table handling. [upload_form]
keflavich commented 9 years ago

Everything looks fine. I don't know what went wrong.

keflavich commented 9 years ago

I've identified the bug: the columns need to be renamed twice. Should work now (pushed to heroku again)

snlongmore commented 9 years ago

@keflavich Success!