commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5012 - trunk/gnue-common/src/datasources


From: jcater
Subject: r5012 - trunk/gnue-common/src/datasources
Date: Fri, 19 Dec 2003 19:40:57 -0600 (CST)

Author: jcater
Date: 2003-12-19 19:40:56 -0600 (Fri, 19 Dec 2003)
New Revision: 5012

Modified:
   trunk/gnue-common/src/datasources/GConnections.py
Log:
added optional event support to GConnections

Modified: trunk/gnue-common/src/datasources/GConnections.py
===================================================================
--- trunk/gnue-common/src/datasources/GConnections.py   2003-12-19 23:08:16 UTC 
(rev 5011)
+++ trunk/gnue-common/src/datasources/GConnections.py   2003-12-20 01:40:56 UTC 
(rev 5012)
@@ -27,6 +27,10 @@
 #
 # NOTES:
 #
+# If you pass GConnections an "eventHandler" instance,
+# it will generate a Connections:Connect(name, base)
+# when a new connection is created.
+#
 # HISTORY:
 #
 
@@ -63,13 +67,15 @@
 
 class GConnections:
 
-  def __init__(self, location, loginHandler=None, loginOptions={}):
+  def __init__(self, location, loginHandler=None, loginOptions={},
+               eventhandler=None):
 
     self._loginHandler = loginHandler
     self._loginOptions = loginOptions
     self._parser = ConfigParser()
     self._location = location
     self._authenticatedUsers = {}
+    self._eventHandler=eventhandler
 
     GDebug.printMesg(1,'Conn File: "%s"' % location)
 
@@ -418,6 +424,10 @@
             tmsg = _("User canceled the login request.")
             raise Exceptions.LoginError, tmsg
 
+      if self._eventHandler:
+        self._eventHandler.dispatchEvent('Connections:Connect',
+              name=connection_name, base=connection_base)
+
     # Create the introspection instance
     try:
       behavior = connection.behavior





reply via email to

[Prev in Thread] Current Thread [Next in Thread]