From 1f1c210eb7700e112579349e01eb863a084f6d57 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 5 Jul 2007 20:46:15 +0000 Subject: [PATCH] added some event handling utility code and app name constants git-svn-id: svn://svn.open-ils.org/ILS/trunk@7524 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/python/oils/const.py | 6 +++++- Open-ILS/src/python/oils/utils/utils.py | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/python/oils/const.py b/Open-ILS/src/python/oils/const.py index 283550efef..cde5ad2bd7 100644 --- a/Open-ILS/src/python/oils/const.py +++ b/Open-ILS/src/python/oils/const.py @@ -18,5 +18,9 @@ OILS_NS_OBJ='http://open-ils.org/spec/opensrf/IDL/objects/v1' OILS_NS_PERSIST='http://open-ils.org/spec/opensrf/IDL/persistence/v1' OILS_NS_REPORTER='http://open-ils.org/spec/opensrf/IDL/reporter/v1' -OILS_APP_CSTORE='open-ils.cstore' +OILS_EVENT_SUCCESS = 'SUCCESS' + +OILS_APP_AUTH = 'open-ils.auth' +OILS_APP_CIRC = 'open-ils.circ' +OILS_APP_CSTORE='open-ils.cstore' diff --git a/Open-ILS/src/python/oils/utils/utils.py b/Open-ILS/src/python/oils/utils/utils.py index 9e03cb91ba..bb874c0d33 100644 --- a/Open-ILS/src/python/oils/utils/utils.py +++ b/Open-ILS/src/python/oils/utils/utils.py @@ -13,7 +13,8 @@ # GNU General Public License for more details. # ----------------------------------------------------------------------- -import re +import re, md5 + # ----------------------------------------------------------------------- # Grab-bag of general utility functions @@ -27,6 +28,21 @@ def replace(str, pattern, replace): return re.compile(pattern).sub(replace, str) +def isEvent(evt): + return (evt and isinstance(evt, dict) and evt.get('ilsevent') != None) - +def eventCode(evt): + if isEvent(evt): + return evt['ilsevent'] + return None +def eventText(evt): + if isEvent(evt): + return evt['textcode'] + return None + + +def md5sum(str): + m = md5.new() + m.update(str) + return m.hexdigest() -- 2.11.0