Ticket #1246 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Search results on ckan.net are mistakenly all 'open'

Reported by: adrian.pohl@… Owned by: pudo
Priority: critical Milestone: ckan-sprint-2011-10-28
Component: ckan Keywords:
Cc: Repository: ckan
Theme: none

Description

All package search results on ckan.net are labelled as 'open' even when their license is closed or unknown: http://ckan.net/package

Change History

comment:1 Changed 3 years ago by dread

We have an unresolved issue with the display of the 'open data' icon that showed up when we upgraded ckan.net to the latest beta last week, but I didn't realise the search page http://ckan.net/package was showing all packages as open (the revision page and package pages seem fine).

Last week when I upgraded from 1.4.1 to 1.4.2beta, there was an exception thrown when loading the home page. The exception was in doing the isopen call. It was solved by making some code changes directly on the ckan.net server to make it an attribute query instead of function call. It was strange because this behaviour didn't occur on my machine and all the tests passed. Here are the manual patches on ckan.net (the application.js change is unrelated, by someone else):

diff -r adf254b7c507 ckan/public/scripts/application.js
--- a/ckan/public/scripts/application.js	Sat Jul 23 18:16:15 2011 +0100
+++ b/ckan/public/scripts/application.js	Thu Jul 28 14:10:23 2011 +0000
@@ -2,6 +2,7 @@
   $(document).ready(function () {
     CKAN.Utils.setupUserAutocomplete($('input.autocomplete-user'));
     CKAN.Utils.setupAuthzGroupAutocomplete($('input.autocomplete-authzgroup'));
+    // $('.resource-url').parent(
   });
 }(jQuery));
 
diff -r adf254b7c507 ckan/templates/_util.html
--- a/ckan/templates/_util.html	Sat Jul 23 18:16:15 2011 +0100
+++ b/ckan/templates/_util.html	Thu Jul 28 14:10:23 2011 +0000
@@ -43,7 +43,7 @@
         standard package listing -->
   <ul py:def="package_list(packages)" class="packages">
     <li py:for="package in packages"
-        class="${'fullyopen' if (package.isopen() and package.resources) else None}">
+        class="${'fullyopen' if (package.isopen and package.resources) else None}">
         <div class="header">
 			<span class="title">
 				${h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name))}
@@ -60,7 +60,7 @@
           </ul>
         </py:if>
         <ul class="openness">
-          <py:if test="package.isopen()">
+          <py:if test="package.isopen">
             <li>
               <a href="http://opendefinition.org/okd/" title="This package satisfies the Open Definition.">
                   <img src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" alt="[Open Data]" />
@@ -72,7 +72,7 @@
               </a>
             </li>
           </py:if>
-          <py:if test="not package.isopen()">
+          <py:if test="not package.isopen">
             <li>
               <span class="closed">
                 ${h.icon('lock')} Not Openly Licensed
diff -r adf254b7c507 ckan/templates/home/index.html
--- a/ckan/templates/home/index.html	Sat Jul 23 18:16:15 2011 +0100
+++ b/ckan/templates/home/index.html	Thu Jul 28 14:10:23 2011 +0000
@@ -64,6 +64,7 @@
     </py:if>
 
     <h4>Recently changed packages</h4>
+    <!-- ${c.latest_packages} -->
     ${package_list_from_dict(c.latest_packages)}
 
     <p><a href="${h.url_for(controller='revision', action='index',
diff -r adf254b7c507 ckan/templates/layout_base.html
--- a/ckan/templates/layout_base.html	Sat Jul 23 18:16:15 2011 +0100
+++ b/ckan/templates/layout_base.html	Thu Jul 28 14:10:23 2011 +0000
@@ -101,6 +101,7 @@
     am_authorized_package_create = h.am_authorized(c, actions.PACKAGE_CREATE)
 ?>
           <li py:if="am_authorized_package_create">${h.nav_link(c, _('Add a package'), controller='package', action='new', id=None)}</li>
+          <li><a href="/storage/upload">Upload Data</a></li>
           <li>${h.nav_link(c, _('Tags'), controller='tag', action='index', id=None)}</li>
           <li>${h.nav_link(c, _('Groups'), controller='group', action='index', id=None, highlight_actions = 'new index')}</li>
           <li>${h.nav_link(c, _('About'), controller='home', action='about', id=None)}</li>
diff -r adf254b7c507 ckan/templates/package/read.html
--- a/ckan/templates/package/read.html	Sat Jul 23 18:16:15 2011 +0100
+++ b/ckan/templates/package/read.html	Thu Jul 28 14:10:23 2011 +0000
@@ -56,7 +56,7 @@
     </py:if>
     
     <li class="widget-container widget_text">
-    <py:if test="c.pkg.isopen() and c.pkg.resources">
+    <py:if test="c.pkg.isopen and c.pkg.resources">
       <h3>
         This Package is Open
       </h3>
@@ -80,7 +80,7 @@
       </p>
     </py:if>
 
-    <py:if test="not(c.pkg.isopen() and c.pkg.resources)">
+    <py:if test="not(c.pkg.isopen and c.pkg.resources)">
       <h3 i18n:msg="">This package is Not Open</h3> 
       
       <p>Either because it is not openly licensed or is missing

comment:2 Changed 3 years ago by pudo

I'm afraid to say I don't understand any of this: the faulty display of openness is triggered as removing the brackets turns the isopen() check into a check for the existence of the method. Reverting the changes on the server seems to work without generating exceptions. What exactly is the issue that was supposed to be fixed originally?

comment:3 Changed 3 years ago by pudo

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.