[open-ils-commits] r8722 - branches/acq-experiment/Open-ILS/src/python/oils

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 11 16:07:38 EST 2008


Author: erickson
Date: 2008-02-11 15:38:26 -0500 (Mon, 11 Feb 2008)
New Revision: 8722

Modified:
   branches/acq-experiment/Open-ILS/src/python/oils/event.py
Log:
augmented parse_and_raise to act as a pass-thru when the provided object is not an event

Modified: branches/acq-experiment/Open-ILS/src/python/oils/event.py
===================================================================
--- branches/acq-experiment/Open-ILS/src/python/oils/event.py	2008-02-11 20:37:58 UTC (rev 8721)
+++ branches/acq-experiment/Open-ILS/src/python/oils/event.py	2008-02-11 20:38:26 UTC (rev 8722)
@@ -43,12 +43,18 @@
         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):



More information about the open-ils-commits mailing list