added some event handling utility code and app name constants
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 5 Jul 2007 20:46:15 +0000 (20:46 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 5 Jul 2007 20:46:15 +0000 (20:46 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7524 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/python/oils/const.py
Open-ILS/src/python/oils/utils/utils.py

index 283550e..cde5ad2 100644 (file)
@@ -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'
index 9e03cb9..bb874c0 100644 (file)
@@ -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()