[ckan-discuss] lowercase file formats

David Read david.read at hackneyworkshop.com
Fri Mar 16 14:46:20 GMT 2012


On 16 March 2012 13:17, Rufus Pollock <rufus.pollock at okfn.org> wrote:
> On 16 March 2012 11:36, David Read <david.read at hackneyworkshop.com> wrote:
>> I notice that file formats are now automatically changed to lower
>> case, whatever you type in. I can see this is useful to stop the
>> database ending up with both 'CSV' and 'csv', but I think capitals are
>> often important. e.g. our database has RDFa, iCal, netCDF, Flash
>> Player and having this hard-coded in the logic layer is a rather
>> inflexible. And what if on our site we'd prefer CSV to csv? Also, it
>> doesn't seem right to do this conversion without telling you *after*
>> you submit the form.
>
> Got you. I guess the issue is you end up with a lot CSV vs csv in the
> DB. What about netCDF versus netcdf or Flash versus flash. At least
> for faceting it is clear we need to standardize. So options are:
>
> * Don't change the format you are given (but then standardize into the
> faceting in SOLR?)
> * Change stuff to lower case (not liked but standardized)
>
>> How about just having format autocomplete with some well-known
>> formats, or convert only well-known formats (e.g. csv, xls) to
>> lower/uppercase, rather than the whole lot?
>
> Autocomplete just runs off whole list of existing formats at the
> moment. Autocompleting based on specific formats would add more
> complexity (so if you wanted that change we might want to remove full
> autocomplete).

Yes, exactly. Mostly we care about the top 10 formats. In the meantime
to us getting round to this different auto-complete option, do you
mind if I make the code that forces it to lower case format
configurable to off?

Dave

>
> Sounds like this is all ticketable and real questoin is then cost /
> benefit of this versus other features :-)
>
> rufus
>
>> Dave
>>
>> commit da3edd4371e381c2a631578938e878a2cf612bd9
>> Author: Tom Rees <zephod at gmail.com>
>> Date:   Tue Feb 28 18:26:31 2012 +0000
>>
>>    [#1506]: Force format field to be lowercase in resources.
>>
>> diff --git a/ckan/lib/dictization/model_dictize.py b/ckan/lib/dictization/model_
>> index 309350e..1e1475e 100644
>> --- a/ckan/lib/dictization/model_dictize.py
>> +++ b/ckan/lib/dictization/model_dictize.py
>> @@ -79,6 +79,7 @@ def extras_list_dictize(extras_list, context):
>>
>>  def resource_dictize(res, context):
>>     resource = table_dictize(res, context)
>> +    resource['format'] = resource.get('format','').lower()
>>     extras = resource.pop("extras", None)
>>     if extras:
>>         resource.update(extras)
>>
>> _______________________________________________
>> ckan-discuss mailing list
>> ckan-discuss at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-discuss
>
>
>
> --
> Co-Founder, Open Knowledge Foundation
> Promoting Open Knowledge in a Digital Age
> http://www.okfn.org/ - http://blog.okfn.org/



More information about the ckan-discuss mailing list