commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef/src GFInstance.py


From: Jason Cater
Subject: gnue/gnuef/src GFInstance.py
Date: Thu, 31 May 2001 21:55:54 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/05/31 21:55:54

Modified files:
        gnuef/src      : GFInstance.py 

Log message:
        Made a dialog box appear for unsuccessful logins.  Also, added logic so 
after four unsuccessful logins, program exits.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/src/GFInstance.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue/gnuef/src/GFInstance.py
diff -u gnue/gnuef/src/GFInstance.py:1.2 gnue/gnuef/src/GFInstance.py:1.3
--- gnue/gnuef/src/GFInstance.py:1.2    Thu May 31 21:29:21 2001
+++ gnue/gnuef/src/GFInstance.py        Thu May 31 21:55:54 2001
@@ -34,7 +34,7 @@
 #
 # Copyright (c) 2000 Free Software Foundation
 #
-# $Id: GFInstance.py,v 1.2 2001/06/01 04:29:21 jcater Exp $
+# $Id: GFInstance.py,v 1.3 2001/06/01 04:55:54 jcater Exp $
 #
 
 import pstats
@@ -47,7 +47,7 @@
 from gnue.forms.GFForm import *
 from gnue.forms.GFController import *
 from gnue.forms.GFParser import loadForm 
-from gnue.common import GDebug
+from gnue.common import GDebug, GDataObjects
 
 from gnue.common.GClientApp import * 
 
@@ -481,6 +481,7 @@
     databaseList = self._form.getDatabaseList()
     for key in databaseList.keys():
       object = databaseList[key]
+      attempts = 4
       while 1:
         try:
           #Login
@@ -499,14 +500,29 @@
           passwd = results[1]['passwd']
           
           object.initialize(user,passwd)
-    
+
+        except GDataObjects.ConnectionError: 
+          attempts = attempts - 1
+          if not attempts: 
+            print "\n\nToo many unsuccessful login attempts.  Exiting...\n"
+            sys.exit()
+          message = GFMsgBox(self,"\nInvalid Login.\nPlease Try Again.  ")  
#\n\nActual Error: \n%s" % sys.exc_info()[1])
+          message.show()    
         except DBError:
+          attempts = attempts - 1
+          if not attempts: 
+            print "\n\nToo many unsuccessful login attempts.  Exiting...\n"
+            sys.exit()
           message = GFMsgBox(self,"Database initialization error:\n%s\n%s " % 
(sys.exc_info()[0], sys.exc_info()[1]))
           message.show()
-#        except TypeError: 
+        except TypeError: 
           # For some bizarre reason, the Oracle driver 
           # returns a TypeError for an invalid login????
-#          print "Invalid Login"
+          attempts = attempts - 1
+          if not attempts: 
+            print "\n\nToo many unsuccessful login attempts.  Exiting...\n"
+            sys.exit()
+          print "Invalid Login"
         except:
           # All other errors: make tty sane and re-raise error
           if sys.platform != 'win32':



reply via email to

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