|
9 | 9 | from src.wizard.controller.frmChainedDialogPage import ChainedDialogPage
|
10 | 10 | from src.controllers.Database import Database
|
11 | 11 |
|
| 12 | +from urllib import quote_plus as urlquote |
| 13 | + |
12 | 14 | class DatabaseConfigPanel(ChainedDialogPage,
|
13 | 15 | clsDBConfiguration):
|
14 | 16 |
|
@@ -39,23 +41,26 @@ def setInput(self, data):
|
39 | 41 |
|
40 | 42 | def onTestConnection(self, event):
|
41 | 43 | conn_dict = self.getFieldValues()
|
42 |
| - if self.validateInput(conn_dict['Database']): |
| 44 | + try: |
| 45 | + self.validateInput(conn_dict['Database']) |
43 | 46 | self.conn_dict = conn_dict
|
44 | 47 | self.parent.nextButton.Enable(True)
|
45 |
| - else: |
| 48 | + except: |
46 | 49 | self.parent.nextButton.Enable(False)
|
47 |
| - |
48 |
| - def sanitizeFieldValues(self, value): |
49 |
| - value = value.replace(';','') |
50 |
| - return value |
| 50 | + message = "Invalid connection!" |
| 51 | + title = "Connection Error" |
| 52 | + ico = wx.ICON_EXCLAMATION |
| 53 | + wx.MessageBox(message=message, |
| 54 | + caption=title, |
| 55 | + style=wx.OK | ico) |
51 | 56 |
|
52 | 57 | def getFieldValues(self):
|
53 | 58 | conn_dict = {}
|
54 | 59 | conn_dict['Engine'] = self.choices[self.cbDatabaseType.GetValue()] if self.cbDatabaseType.GetValue() != '' else ''
|
55 |
| - conn_dict['UserName'] = self.sanitizeFieldValues(str(self.txtUser.GetValue())) |
56 |
| - conn_dict['Password'] = self.sanitizeFieldValues(str(self.txtPass.GetValue())) |
57 |
| - conn_dict['Address'] = self.sanitizeFieldValues(str(self.txtServer.GetValue())) |
58 |
| - conn_dict['DatabaseName'] = self.sanitizeFieldValues(str(self.txtDBName.GetValue())) |
| 60 | + conn_dict['UserName'] = (str(self.txtUser.GetValue())) |
| 61 | + conn_dict['Password'] = (str(self.txtPass.GetValue())) |
| 62 | + conn_dict['Address'] = (str(self.txtServer.GetValue())) |
| 63 | + conn_dict['DatabaseName'] = (str(self.txtDBName.GetValue())) |
59 | 64 | return {'Database': conn_dict}
|
60 | 65 |
|
61 | 66 | def validateInput(self, conn_dict):
|
|
0 commit comments