dabo Commit
Revision 5476
Date: 2009-10-19 21:16:51 -0700 (Mon, 19 Oct 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5476
Changed:
U trunk/dabo/dApp.py
U trunk/dabo/dSecurityManager.py
Log:
Decoupled the login screen from the main form, so it can show before the main
form is even instantiated.
Added a test script to dSecurityManager using the default login dialog.
Diff:
Modified: trunk/dabo/dApp.py
===================================================================
--- trunk/dabo/dApp.py 2009-10-19 20:17:32 UTC (rev 5475)
+++ trunk/dabo/dApp.py 2009-10-20 04:16:51 UTC (rev 5476)
@@ -21,7 +21,7 @@
import dabo.dException as dException
from dabo.dLocalize import _
from dabo.lib.connParser import importConnections
-from dabo import dSecurityManager
+from dSecurityManager import dSecurityManager
from dabo.lib.SimpleCrypt import SimpleCrypt
from dabo.dObject import dObject
from dabo import dUserSettingProvider
@@ -377,7 +377,7 @@
self._finished = False
if (not self.SecurityManager or not
self.SecurityManager.RequireAppLogin
- or self.SecurityManager.login()):
+ or getattr(self, "_loggedIn", False) or
self.SecurityManager.login()):
userName = self.getUserCaption()
if userName:
@@ -440,7 +440,7 @@
Return a tuple of (user, pass).
"""
- loginDialog = self.LoginDialogClass(self.MainForm)
+ loginDialog = self.LoginDialogClass(None)
loginDialog.setMessage(message)
# Allow the developer to customize the login dialog:
self.loginDialogHook(loginDialog)
@@ -1513,12 +1513,9 @@
return None
def _setSecurityManager(self, value):
- if isinstance(value, dSecurityManager.dSecurityManager):
- if self.SecurityManager:
- warnings.warn(Warning, _("SecurityManager
previously set"))
- self._securityManager = value
- else:
- raise TypeError(_("SecurityManager must descend from
dSecurityManager."))
+ if self.SecurityManager:
+ warnings.warn(Warning, _("SecurityManager previously
set"))
+ self._securityManager = value
def _getShowCommandWindowMenu(self):
Modified: trunk/dabo/dSecurityManager.py
===================================================================
--- trunk/dabo/dSecurityManager.py 2009-10-19 20:17:32 UTC (rev 5475)
+++ trunk/dabo/dSecurityManager.py 2009-10-20 04:16:51 UTC (rev 5476)
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import time
+import dabo
from dabo.dObject import dObject
from dLocalize import _
@@ -49,6 +50,7 @@
time.sleep(self.LoginPause)
if ret:
+ self.Application._loggedIn = True
self.afterLoginSuccess()
else:
self.afterLoginFailure()
@@ -188,4 +190,20 @@
UserName = property(_getUserName, None, None,
_("""The name of the logged-on user. Read-only."""))
-
+
+if __name__ == "__main__":
+ app = dabo.dApp(MainFormClass=None)
+ app.setup()
+
+ class TestSM(dSecurityManager):
+ def validateLogin(self, user, passwd):
+ print user, passwd
+ if user == "paul" and passwd == "23":
+ return True
+ return False
+
+ app.SecurityManager = TestSM()
+ if app.SecurityManager.login():
+ app.MainForm = dabo.ui.dFormMain()
+ app.start()
+
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]