##// END OF EJS Templates
events: Add a method to model base class for sending events....
johbo -
r229:a33067ed default
parent child Browse files
Show More
@@ -43,6 +43,7 b" The application's model objects"
43 43 import logging
44 44
45 45 from pylons import config
46 from pyramid.threadlocal import get_current_registry
46 47
47 48 from rhodecode.model import meta, db
48 49 from rhodecode.lib.utils2 import obfuscate_url_pw
@@ -144,6 +145,17 b' class BaseModel(object):'
144 145 return self._get_instance(
145 146 db.Permission, permission, callback=db.Permission.get_by_key)
146 147
148 def send_event(self, event):
149 """
150 Helper method to send an event. This wraps the pyramid logic to send an
151 event.
152 """
153 # For the first step we are using pyramids thread locals here. If the
154 # event mechanism works out as a good solution we should think about
155 # passing the registry into the constructor to get rid of it.
156 registry = get_current_registry()
157 registry.notify(event)
158
147 159 @classmethod
148 160 def get_all(cls):
149 161 """
General Comments 0
You need to be logged in to leave comments. Login now