Commits

Peter Sanchez committed 0982603

Added error_callback signal

  • Participants
  • Parent commits 62ee4c1

Comments (0)

Files changed (3)

callback/__init__.py

 from callback import callback_manager
 from base import CallbackException, CallbackBase
-from signals import stored_callback, processed_callback
+from signals import stored_callback, processed_callback, error_callback
 
 
 __version__ = '0.3'
 __all__ = [
     'CallbackException', 'CallbackBase', 'callback_manager',
-    'stored_callback', 'processed_callback',
+    'stored_callback', 'processed_callback', 'error_callback',
 ]

callback/callback.py

 from django.db import models
 from models import CallbackMap
 from base import CallbackException, CallbackBase
-from signals import stored_callback, processed_callback
+from signals import stored_callback, processed_callback, error_callback
 
 REQUIRED_METHODS = ('process',)
 
             )
         except Exception, e:
             callback_instance.mark_error(str(e))
+            error_callback.send(
+                sender=self,
+                callback_instance=callback_instance,
+                model_instance=model,
+            )
             raise CallbackException(str(e))
 
 

callback/signals.py

 processed_callback = dispatch.Signal(
     providing_args=['callback_instance', 'model_instance'],
 )
+
+error_callback = dispatch.Signal(
+    providing_args=['callback_instance', 'model_instance'],
+)