[ckan-changes] commit/ckanext-qa: John Glover: [qa] when calculating mime-type for scores, use file type before server content-type value

Bitbucket commits-noreply at bitbucket.org
Thu Jul 28 13:43:34 UTC 2011


1 new changeset in ckanext-qa:

http://bitbucket.org/okfn/ckanext-qa/changeset/999c4225c9cc/
changeset:   999c4225c9cc
user:        John Glover
date:        2011-07-28 15:42:44
summary:     [qa] when calculating mime-type for scores, use file type before server content-type value
affected #:  1 file (3 bytes)

--- a/ckanext/qa/lib/package_scorer.py	Thu Jul 28 14:25:51 2011 +0100
+++ b/ckanext/qa/lib/package_scorer.py	Thu Jul 28 14:42:44 2011 +0100
@@ -84,11 +84,11 @@
                 format = resource.get('format', '').lower()
                 file_type = mimetypes.guess_type(resource.get('url'))[0] 
 
-                # content-type takes priority for scoring
-                if ct:
+                # file type takes priority for scoring
+                if file_type:
+                    openness_score = score_by_mime_type.get(file_type, '-1')
+                elif ct:
                     openness_score = score_by_mime_type.get(ct, '-1')
-                elif file_type:
-                    openness_score = score_by_mime_type.get(file_type, '-1')
                 elif format:
                     openness_score = score_by_mime_type.get(format, '-1')

Repository URL: https://bitbucket.org/okfn/ckanext-qa/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list