Skip to content

Commit

Permalink
view的异常捕获
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo authored and lihuanhuan committed Apr 28, 2018
1 parent bd36cfc commit a6a25ed
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions sql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,21 @@ def submitSql(request):
listAllClusterName = [master.cluster_name for master in masters]

dictAllClusterDb = OrderedDict()
#每一个都首先获取主库地址在哪里
for clusterName in listAllClusterName:
listMasters = master_config.objects.filter(cluster_name=clusterName)
#取出该集群的名称以及连接方式,为了后面连进去获取所有databases
masterHost = listMasters[0].master_host
masterPort = listMasters[0].master_port
masterUser = listMasters[0].master_user
masterPassword = prpCryptor.decrypt(listMasters[0].master_password)

listDb = dao.getAlldbByCluster(masterHost, masterPort, masterUser, masterPassword)
dictAllClusterDb[clusterName] = listDb
try:
#每一个都首先获取主库地址在哪里
for clusterName in listAllClusterName:
listMasters = master_config.objects.filter(cluster_name=clusterName)
#取出该集群的名称以及连接方式,为了后面连进去获取所有databases
masterHost = listMasters[0].master_host
masterPort = listMasters[0].master_port
masterUser = listMasters[0].master_user
masterPassword = prpCryptor.decrypt(listMasters[0].master_password)

listDb = dao.getAlldbByCluster(masterHost, masterPort, masterUser, masterPassword)
dictAllClusterDb[clusterName] = listDb
except Exception as msg:
context = {'errMsg': str(msg)}
return render(request, 'error.html', context)

#获取所有审核人
loginUser = request.session.get('login_username', False)
Expand Down

0 comments on commit a6a25ed

Please sign in to comment.