Changeset 2856
- Timestamp:
- 02/26/07 09:38:55 (1 year ago)
- Files:
-
- branches/uwe/dabo/biz/dBizobj.py (modified) (3 diffs)
- branches/uwe/dabo/dApp.py (modified) (1 diff)
- branches/uwe/dabo/dSecurityManager.py (modified) (1 diff)
- branches/uwe/dabo/db/dConnectInfo.py (modified) (3 diffs)
- branches/uwe/dabo/db/dConnection.py (modified) (1 diff)
- branches/uwe/dabo/db/dCursorMixin.py (modified) (1 diff)
- branches/uwe/dabo/db/test/test_dConnectInfo.py (copied) (copied from trunk/dabo/db/test/test_dConnectInfo.py)
- branches/uwe/dabo/db/test/test_dConnection.py (copied) (copied from trunk/dabo/db/test/test_dConnection.py)
- branches/uwe/dabo/ui/uiwx/uiApp.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/uwe/dabo/biz/dBizobj.py
r2836 r2856 34 34 self._conn = conn 35 35 36 super(dBizobj, self).__init__(properties=properties, *args, **kwargs)37 38 36 cn = self._conn 39 37 if cn: … … 45 43 self.createCursor() 46 44 47 48 45 # We need to make sure the cursor is created *before* the call to 49 46 # initProperties() 50 47 self._initProperties() 48 super(dBizobj, self).__init__(properties=properties, *args, **kwargs) 51 49 self._afterInit() 52 50 self.__att_try_setFieldVal = True … … 721 719 is built. 722 720 """ 723 if self.DataSource and self.LinkField :721 if self.DataSource and self.LinkField and self.Parent: 724 722 if self.Parent.IsAdding: 725 723 # Parent is new and not yet saved, so we cannot have child records yet. branches/uwe/dabo/dApp.py
r2840 r2856 291 291 292 292 293 def getLoginInfo(self, message=None): 294 """Return the user/password to dSecurityManager.login(). 295 296 The default is to display the standard login dialog, and return the 297 user/password as entered by the user, but subclasses can override to get 298 the information from whereever is appropriate. 299 300 Return a tuple of (user, pass). 301 """ 302 import dabo.ui.dialogs.login as login 303 ld = login.Login(self.MainForm) 304 ld.setMessage(message) 305 ld.show() 306 user, password = ld.user, ld.password 307 return user, password 308 309 293 310 def _persistMRU(self): 294 311 """Persist any MRU lists to disk.""" branches/uwe/dabo/dSecurityManager.py
r1482 r2856 18 18 message = _("Login incorrect, please try again. (%s/%s)") % ( 19 19 attempt+1, self.LoginAttemptsAllowed) 20 user, password = self.Application. uiApp.getLoginInfo(message)20 user, password = self.Application.getLoginInfo(message) 21 21 22 22 if user is None: branches/uwe/dabo/db/dConnectInfo.py
r2445 r2856 47 47 self._host = self._user = self._password = self._dbType = self._database = self._port = self._name = "" 48 48 super(dConnectInfo, self).__init__(**kwargs) 49 if connInfo: 49 if connInfo: 50 50 self.setConnInfo(connInfo) 51 51 … … 81 81 connDict = cd[nm] 82 82 83 # They passed a dictionary containing the connection settings 84 if connDict.has_key("name"): 85 self.Name = connDict["name"] 86 if connDict.has_key("dbtype"): 87 self.DbType = connDict["dbtype"] 88 if connDict.has_key("host"): 89 self.Host = connDict["host"] 90 if connDict.has_key("user"): 91 self.User = connDict["user"] 92 if connDict.has_key("password"): 93 self.Password = connDict["password"] 94 if connDict.has_key("plaintextpassword"): 95 self.PlainTextPassword = connDict["plaintextpassword"] 96 if connDict.has_key("database"): 97 self.Database = connDict["database"] 98 if connDict.has_key("port"): 99 try: 100 self.Port = int(connDict["port"]) 101 except ValueError: 102 # No valid port given 103 self.Port = None 83 # Run through the connDict, and set the appropriate properties. If it isn't 84 # a valid property name, raise TypeError. 85 mapping = {"name": "Name", "dbtype": "DbType", "host": "Host", 86 "user": "User", "password": "Password", "database": "Database", 87 "plaintextpassword": "PlainTextPassword", "port": "Port"} 88 for k, v in connDict.items(): 89 prop = mapping.get(k, None) 90 if prop: 91 setattr(self, prop, v) 92 else: 93 raise TypeError, "Property '%s' invalid." % k 104 94 105 95 … … 226 216 return self._port 227 217 228 def _setPort(self, port): 229 self._port = port 218 def _setPort(self, port): 219 try: 220 self._port = int(port) 221 except: 222 self._port = None 230 223 231 224 branches/uwe/dabo/db/dConnection.py
r2385 r2856 21 21 if isinstance(connectInfo, dConnectInfo): 22 22 self._connectInfo = connectInfo 23 elif connectInfo: 24 # If they passed a cnxml file, or a dict containing valid connection info, 25 # this will work fine. Otherwise, an error will be raised in the 26 # dConnectInfo class. 27 self._connectInfo = dConnectInfo(connInfo=connectInfo) 23 28 else: 24 # If they passed a cnxml file, or a dict containing 25 # valid connection info, this will work fine. Otherwise, 26 # an error will be raised in the dConnectInfo class. 27 self._connectInfo = dConnectInfo(connInfo=connectInfo) 29 raise TypeError, "dConnectInfo instance or kwargs not sent." 28 30 self._connection = self._openConnection() 29 31 branches/uwe/dabo/db/dCursorMixin.py
r2848 r2856 1913 1913 def oldVal(self, fieldName, row=None): 1914 1914 """Returns the value of the field as it existed after the last requery.""" 1915 if self.RowCount < 1: 1916 raise dabo.dException.NoRecordsException 1915 1917 if row is None: 1916 1918 row = self.RowNumber branches/uwe/dabo/ui/uiwx/uiApp.py
r2648 r2856 796 796 797 797 798 def getLoginInfo(self, message=None):799 """ Display the login form, and return the user/password800 as entered by the user.801 """802 import dabo.ui.dialogs.login as login803 ld = login.Login(self.dApp.MainForm)804 ld.setMessage(message)805 ld.show()806 user, password = ld.user, ld.password807 return user, password808 809 810 798 def _getActiveForm(self): 811 799 if self._platform == "Win":
