Mercurial > public > sg101
comparison phantombrigade/views.py @ 648:10f3acc18b2d
Improve TS3 error handling when remote server is kaput (#33).
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 23 Mar 2013 13:38:32 -0500 |
parents | ee87ea74d46b |
children | 89b240fe9297 |
comparison
equal
deleted
inserted
replaced
647:2a4e2e86c65e | 648:10f3acc18b2d |
---|---|
40 settings.PB_TS3_VID) | 40 settings.PB_TS3_VID) |
41 except ts3.ConnectionError: | 41 except ts3.ConnectionError: |
42 return HttpResponseServerError() | 42 return HttpResponseServerError() |
43 | 43 |
44 response = svr.send_command('serverinfo') | 44 response = svr.send_command('serverinfo') |
45 if response.response['msg'] != 'ok': | 45 if response.response.get('msg') != 'ok': |
46 return HttpResponseServerError() | 46 return HttpResponseServerError() |
47 svr_info = response.data[0] | 47 svr_info = response.data[0] |
48 | 48 |
49 response = svr.send_command('channellist') | 49 response = svr.send_command('channellist') |
50 if response.response['msg'] != 'ok': | 50 if response.response.get('msg') != 'ok': |
51 return HttpResponseServerError() | 51 return HttpResponseServerError() |
52 channel_list = response.data | 52 channel_list = response.data |
53 | 53 |
54 response = svr.send_command('clientlist') | 54 response = svr.send_command('clientlist') |
55 if response.response['msg'] != 'ok': | 55 if response.response.get('msg') != 'ok': |
56 return HttpResponseServerError() | 56 return HttpResponseServerError() |
57 client_list = response.data | 57 client_list = response.data |
58 | 58 |
59 # Start building the channel / client tree. | 59 # Start building the channel / client tree. |
60 # We save tree nodes in a dictionary, keyed by their id so we can find them | 60 # We save tree nodes in a dictionary, keyed by their id so we can find them |