Skip to content

Commit

Permalink
Fix for non-open licenses appearing open
Browse files Browse the repository at this point in the history
The 'This dataset is openly licensed' icon was appearing next to
non-open datasets as well. The problem was that DefaultLicense was
returning u"False" (a string) for boolean attributes such as
is_okd_compliant. Change the class so it no longer turns non-string
attributes into unicode strings when you access them.
  • Loading branch information
Sean Hammond authored and tobes committed Aug 16, 2012
1 parent 0ae6671 commit aa710e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckan/model/license.py
Expand Up @@ -153,7 +153,11 @@ class DefaultLicense(dict):
def __getitem__(self, key):
''' behave like a dict but get from attributes '''
if key in self.keys:
return unicode(getattr(self, key))
value = getattr(self, key)
if isinstance(value, str):
return unicode(value)
else:
return value
else:
raise KeyError()

Expand Down

0 comments on commit aa710e4

Please sign in to comment.