project-open-data / catalog-generator

A multi-format tool to generate and maintain agency.gov/data catalog files.
http://project-open-data.github.com/catalog-generator/
21 stars 18 forks source link

import for the 'public' field doesn't work #13

Closed gbinal closed 11 years ago

gbinal commented 11 years ago

When importing a csv, the public field (marked with 'TRUE' in the csv) isn't resulting in a value being chosen even after it was correctly mapped.

benbalter commented 11 years ago

This problem stems from being a bit loose with types. "true" is a string containing the word "true". true is a boolean meaning true. 3d64d74 tells backbone to evaluate the truthiness of the public attribute every time the model is updated, and forces the value to be a boolean.

This means that from now on, "TRUE" should evaluate as truthy. This means however, that "false" will also evaluate as truthy (because javascript sees a word, but doesn't know what that word means).

If you'd like to update the documentation somewhere, may make sense, but I believe if you leave the field empty, it will be evaluated as false, and put anything truthy (e.g., 1, "true", "Y", etc.) it will be evaluated as true.

The problem is there are so many human-readable ways to mark false. It could be 0, N, false, FALSE, false, No, etc. Can't solve for every use case without a substantial lift.