augmented parse_and_raise to act as a pass-thru when the provided object is not an...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 Feb 2008 20:37:58 +0000 (20:37 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 Feb 2008 20:37:58 +0000 (20:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8721 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/python/oils/event.py

index fad03f2..9d5d3d8 100644 (file)
@@ -43,12 +43,18 @@ class Event(object):
         return None
 
     @staticmethod
-    def parse_and_raise(evt=None):
+    def parse_and_raise(obj=None):
         ''' Parses with parse_event.  If the resulting event is a non-success
-            event, it is converted to an exception and raised '''
-        evt = Event.parse_event(evt)
-        if evt and not evt.success:
+            event, it is converted to an exception and raised.  If the resulting
+            event is a success event, the event object is returned.  If the
+            object is not an event, the original original object is returned 
+            unchanged. '''
+        evt = Event.parse_event(obj)
+        if evt:
+            if evt.success:
+                return evt
             raise evt.to_ex()
+        return obj
 
 
 class EventException(osrf.ex.OSRFException):