From 7ee5348f996be8ff7a0301fc581e69a1ced40402 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 11 Feb 2008 20:37:58 +0000 Subject: [PATCH] augmented parse_and_raise to act as a pass-thru when the provided object is not an event git-svn-id: svn://svn.open-ils.org/ILS/trunk@8721 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/python/oils/event.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/python/oils/event.py b/Open-ILS/src/python/oils/event.py index fad03f2417..9d5d3d821c 100644 --- a/Open-ILS/src/python/oils/event.py +++ b/Open-ILS/src/python/oils/event.py @@ -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): -- 2.11.0