[ckan-changes] commit/ckan: dread: [model, lib]: Removed some exception catches.

Bitbucket commits-noreply at bitbucket.org
Tue Aug 23 16:45:31 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/47225f03e2af/
changeset:   47225f03e2af
branch:      defect-1172-exceptions
user:        dread
date:        2011-08-23 18:41:14
summary:     [model, lib]: Removed some exception catches.
affected #:  5 files (491 bytes)

--- a/ckan/lib/search/worker.py	Wed Aug 10 16:36:57 2011 +0100
+++ b/ckan/lib/search/worker.py	Tue Aug 23 17:41:14 2011 +0100
@@ -26,7 +26,6 @@
             log.warn("Unknown operation: %s" % operation)
     except Exception, ex:
         log.exception(ex)
-        raise
 
 
 class SynchronousSearchPlugin(SingletonPlugin):


--- a/ckan/model/modification.py	Wed Aug 10 16:36:57 2011 +0100
+++ b/ckan/model/modification.py	Tue Aug 23 17:41:14 2011 +0100
@@ -1,3 +1,5 @@
+import logging
+
 from vdm.sqlalchemy import State
 
 from sqlalchemy.orm import object_session
@@ -14,6 +16,7 @@
 from ckan.model.package_extra import PackageExtra
 from ckan.model.tag import PackageTag
 
+log = logging.getLogger(__name__)
 
 class DomainObjectModificationExtension(SingletonPlugin, ObserverNotifier):
     """
@@ -63,4 +66,10 @@
 
     def notify(self, entity, operation):
         for observer in self.observers:
-            observer.notify(entity, operation)
+            try:
+                observer.notify(entity, operation)
+            except Exception, ex:
+                log.exception(ex)
+                # We reraise all exceptions so they are obvious there
+                # is something wrong
+                raise


--- a/ckan/model/package.py	Wed Aug 10 16:36:57 2011 +0100
+++ b/ckan/model/package.py	Tue Aug 23 17:41:14 2011 +0100
@@ -333,9 +333,13 @@
         return [(l.title, l.id) for l in register.values()]
 
     def get_license(self):
-        license = None
         if self.license_id:
-            license = self.get_license_register()[self.license_id]
+            try:
+                license = self.get_license_register()[self.license_id]
+            except KeyError:
+                license = None
+        else:
+            license = None
         return license
 
     def set_license(self, license):


--- a/ckan/plugins/interfaces.py	Wed Aug 10 16:36:57 2011 +0100
+++ b/ckan/plugins/interfaces.py	Tue Aug 23 17:41:14 2011 +0100
@@ -166,7 +166,7 @@
 
 class IDomainObjectModification(Interface):
     """
-    Receives notification of new, changed and deleted domain objects
+    Receives notification of new, changed and deleted domain objects.
     """
 
     def notify(self, entity, operation):


--- a/ckan/tests/models/test_changeset.py	Wed Aug 10 16:36:57 2011 +0100
+++ b/ckan/tests/models/test_changeset.py	Tue Aug 23 17:41:14 2011 +0100
@@ -10,6 +10,10 @@
 import ckan.model as model
 from ckan.model import setup_default_user_roles
 
+# Changesets deprecated - tests skipped (see #1002)
+from nose.plugins.skip import SkipTest
+raise SkipTest()
+
 class TestCase(object):
 
     def setup(self):

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