commit-gnue
[Top][All Lists]
Advanced

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

gnue common/src/GConnections.py forms/src/GFFor...


From: Jason Cater
Subject: gnue common/src/GConnections.py forms/src/GFFor...
Date: Sun, 01 Dec 2002 18:04:46 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Branch:         forms-0-4-1-branch
Changes by:     Jason Cater <address@hidden>    02/12/01 18:04:46

Modified files:
        common/src     : GConnections.py 
        forms/src      : GFForm.py 

Log message:
        backported the getAuthenticatedUser() support

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConnections.py.diff?only_with_tag=common-0-4-1-branch&tr1=1.44&tr2=1.44.4.1&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?only_with_tag=forms-0-4-1-branch&tr1=1.202&tr2=1.202.2.1&r1=text&r2=text

Patches:
Index: gnue/common/src/GConnections.py
diff -c gnue/common/src/GConnections.py:1.44 
gnue/common/src/GConnections.py:1.45
*** gnue/common/src/GConnections.py:1.44        Wed Sep 18 02:49:27 2002
--- gnue/common/src/GConnections.py     Sun Dec  1 17:53:04 2002
***************
*** 66,71 ****
--- 66,72 ----
      self._loginHandler = loginHandler
      self._parser = ConfigParser()
      self._location = location
+     self._authenticatedUsers = {}
  
      GDebug.printMesg(1,'Conn File: "%s"' % location)
  
***************
*** 259,265 ****
            break
  
        if haveAllInformation:
!         if authenticator: 
            dataObject.connect(authenticator.login(loginData))
          else:
            dataObject.connect(loginData)
--- 260,271 ----
            break
  
        if haveAllInformation:
!         try:
!           self._authenticatedUsers[connection] = loginData['_username']
!         except KeyError:
!           self._authenticatedUsers[connection] = None
! 
!         if authenticator:
            dataObject.connect(authenticator.login(loginData))
          else:
            dataObject.connect(loginData)
***************
*** 283,290 ****
                 self.getConnectionParameter(connection_name,'comment',''),
                 dataObject.getLoginFields()], errortext))
  
              # Ask the data object to connect to the database
!             dataObject.connect(loginData)
  
              # Save the newly opened connection for future datasources
              self._openConnections[connection_name] = \
--- 289,305 ----
                 self.getConnectionParameter(connection_name,'comment',''),
                 dataObject.getLoginFields()], errortext))
  
+             # Add to authenticated user list
+             try:
+               self._authenticatedUsers[connection] = loginData['_username']
+             except KeyError:
+               self._authenticatedUsers[connection] = None
+ 
              # Ask the data object to connect to the database
!             if authenticator:
!               dataObject.connect(authenticator.login(loginData))
!             else:
!               dataObject.connect(loginData)
  
              # Save the newly opened connection for future datasources
              self._openConnections[connection_name] = \
***************
*** 312,317 ****
--- 327,340 ----
              self._loginHandler.destroyLoginDialog()
              raise GDataObjects.LoginError, _("User canceled the login 
request.")
  
+   def getAuthenticatedUser(self, connection=None):
+     try:
+       if connection == None:
+         return self._authenticatedUsers[self._authenticatedUsers.keys()[0]]
+       else:
+         return self._authenticatedUsers[connection]
+     except (KeyError, IndexError):
+       return None
  
  
  
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.214 gnue/forms/src/GFForm.py:1.215
*** gnue/forms/src/GFForm.py:1.214      Fri Nov 29 02:07:00 2002
--- gnue/forms/src/GFForm.py    Sun Dec  1 17:53:04 2002
***************
*** 101,106 ****
--- 101,109 ----
      self._triggerFunctions = {'setFocus':{'function':self.triggerSetFocus,
                                            'global': 1,
                                            },
+                               
'getAuthenticatedUser':{'function':self.getAuthenticatedUser,
+                                           'global': 1,
+                                           },
                                
'getCurrentEntry':{'function':self.triggerGetCurrentEntry,
                                            'global': 1,
                                            },
***************
*** 763,766 ****
      except KeyError:
        raise KeyError, "Trigger attempted to get unknown feature %s" % feature
  
! 
--- 766,770 ----
      except KeyError:
        raise KeyError, "Trigger attempted to get unknown feature %s" % feature
  
!   def getAuthenticatedUser(self, connection=None):
!     return self._instance.connections.getAuthenticatedUser(connection)




reply via email to

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