mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 00:38:11 -05:00
Thing: Use a hook for on_thing_commit.
This commit is contained in:
@@ -35,7 +35,7 @@ from .. utils import iters, Results, tup, to36, Storage, thing_utils, timefromno
|
||||
from r2.config import cache
|
||||
from r2.lib.cache import sgm
|
||||
from r2.lib.log import log_text
|
||||
from r2.lib import stats
|
||||
from r2.lib import stats, hooks
|
||||
from pylons import g
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ class DataThing(object):
|
||||
if lock:
|
||||
lock.release()
|
||||
|
||||
g.plugins.on_thing_commit(self, to_set)
|
||||
hooks.get_hook("thing.commit").call(thing=self, changes=to_set)
|
||||
|
||||
@classmethod
|
||||
def _load_multi(cls, need):
|
||||
|
||||
@@ -78,8 +78,6 @@ class Plugin(object):
|
||||
def load_controllers(self):
|
||||
pass
|
||||
|
||||
def on_thing_commit(self, thing, changes):
|
||||
pass
|
||||
|
||||
|
||||
class PluginLoader(object):
|
||||
@@ -149,7 +147,3 @@ class PluginLoader(object):
|
||||
def load_controllers(self):
|
||||
for plugin in self:
|
||||
plugin.load_controllers()
|
||||
|
||||
def on_thing_commit(self, thing, changes):
|
||||
for plugin in self:
|
||||
plugin.on_thing_commit(thing, changes)
|
||||
|
||||
Reference in New Issue
Block a user