Skip to content

Commit

Permalink
[#3633] Marked notify_after_commit interface deprecated and removed n…
Browse files Browse the repository at this point in the history
…on-working code that calls it.
  • Loading branch information
David Read committed Jun 23, 2017
1 parent 214ccf6 commit a35d083
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
28 changes: 1 addition & 27 deletions ckan/model/modification.py
Expand Up @@ -24,22 +24,11 @@ class DomainObjectModificationExtension(plugins.SingletonPlugin):

plugins.implements(plugins.ISession, inherit=True)

def notify_observers(self, func):
"""
Call func(observer) for all registered observers.
:param func: Any callable, which will be called for each observer
:returns: EXT_CONTINUE if no errors encountered, otherwise EXT_STOP
"""
for observer in plugins.PluginImplementations(
plugins.IDomainObjectModification):
func(observer)

def before_commit(self, session):
self.notify_observers(session, self.notify)

def after_commit(self, session):
self.notify_observers(session, self.notify_after_commit)
pass

def notify_observers(self, session, method):
session.flush()
Expand Down Expand Up @@ -95,18 +84,3 @@ def notify(self, entity, operation):
log.exception(ex)
# Don't reraise other exceptions since they are generally of
# secondary importance so shouldn't disrupt the commit.

def notify_after_commit(self, entity, operation):
for observer in plugins.PluginImplementations(
plugins.IDomainObjectModification):
try:
observer.notify_after_commit(entity, operation)
except SearchIndexError, search_error:
log.exception(search_error)
# Reraise, since it's pretty crucial to ckan if it can't index
# a dataset
raise
except Exception, ex:
log.exception(ex)
# Don't reraise other exceptions since they are generally of
# secondary importance so shouldn't disrupt the commit.
5 changes: 4 additions & 1 deletion ckan/plugins/interfaces.py
Expand Up @@ -239,7 +239,10 @@ def notify(self, entity, operation):

def notify_after_commit(self, entity, operation):
u'''
Send a notification after entity modification.
** DEPRECATED **
Supposed to send a notification after entity modification, but it
doesn't work.
:param entity: instance of module.Package.
:param operation: 'new', 'changed' or 'deleted'.
Expand Down

0 comments on commit a35d083

Please sign in to comment.