[ckan-changes] commit/ckan: kindly: [search] #1346 log errors when ckan cannot find a package

Bitbucket commits-noreply at bitbucket.org
Wed Sep 28 15:30:09 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/294a0b6577b0/
changeset:   294a0b6577b0
user:        kindly
date:        2011-09-28 17:29:57
summary:     [search] #1346 log errors when ckan cannot find a package
affected #:  1 file (-1 bytes)

--- a/ckan/logic/action/get.py	Wed Sep 28 14:24:18 2011 +0100
+++ b/ckan/logic/action/get.py	Wed Sep 28 16:29:57 2011 +0100
@@ -22,6 +22,9 @@
                                                 tag_to_api1,
                                                 tag_to_api2)
 from ckan.lib.search import query_for, SearchError
+import logging
+
+log = logging.getLogger('ckan.logic')
 
 def site_read(context,data_dict=None):
     check_access('site_read',context,data_dict)
@@ -617,6 +620,12 @@
             ))
         pkg = pkg_query.first()
 
+        ## if the index has got a package that is not in ckan then
+        ## ignore it.
+        if not pkg:
+            log.warning('package %s in index but not in database' % package)
+            continue
+
         result_dict = table_dictize(pkg, context)
         result_dict = _extend_package_dict(result_dict,context)
         results.append(result_dict)

Repository URL: https://bitbucket.org/okfn/ckan/

--

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