[open-ils-commits] r7524 - in trunk/Open-ILS/src/python/oils: . utils

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 5 16:50:09 EDT 2007


Author: erickson
Date: 2007-07-05 16:46:15 -0400 (Thu, 05 Jul 2007)
New Revision: 7524

Modified:
   trunk/Open-ILS/src/python/oils/const.py
   trunk/Open-ILS/src/python/oils/utils/utils.py
Log:
added some event handling utility code and app name constants

Modified: trunk/Open-ILS/src/python/oils/const.py
===================================================================
--- trunk/Open-ILS/src/python/oils/const.py	2007-07-05 20:32:28 UTC (rev 7523)
+++ trunk/Open-ILS/src/python/oils/const.py	2007-07-05 20:46:15 UTC (rev 7524)
@@ -18,5 +18,9 @@
 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_EVENT_SUCCESS = 'SUCCESS'
+
+OILS_APP_AUTH = 'open-ils.auth'
+OILS_APP_CIRC = 'open-ils.circ'
 OILS_APP_CSTORE='open-ils.cstore'
-

Modified: trunk/Open-ILS/src/python/oils/utils/utils.py
===================================================================
--- trunk/Open-ILS/src/python/oils/utils/utils.py	2007-07-05 20:32:28 UTC (rev 7523)
+++ trunk/Open-ILS/src/python/oils/utils/utils.py	2007-07-05 20:46:15 UTC (rev 7524)
@@ -13,8 +13,9 @@
 # GNU General Public License for more details.
 # -----------------------------------------------------------------------
 
-import re
+import re, md5
 
+
 # -----------------------------------------------------------------------
 # Grab-bag of general utility functions
 # -----------------------------------------------------------------------
@@ -27,6 +28,21 @@
    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()



More information about the open-ils-commits mailing list