Author: damoxc
Revision: 4907
Log:
fix adding hosts and clearing the form after changing password to
_password
Diff:
Modified: trunk/deluge/ui/web/js/deluge-connections.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-connections.js 2009-03-21 11:15:17 UTC
(rev 4906)
+++ trunk/deluge/ui/web/js/deluge-connections.js 2009-03-21 11:21:05 UTC
(rev 4907)
@@ -52,14 +52,14 @@
var host = form.items.get('host').getValue();
var port = form.items.get('port').getValue();
var username = form.items.get('username').getValue();
- var password = form.items.get('password').getValue();
+ var password = form.items.get('_password').getValue();
Deluge.Client.web.add_host(host, port, username, password, {
onSuccess: function(result) {
- if (!result) {
+ if (!result[0]) {
Ext.MessageBox.show({
title: _('Error'),
- msg: "Unable to add host",
+ msg: "Unable to add host: " + result[1],
buttons: Ext.MessageBox.OK,
modal: false,
icon: Ext.MessageBox.ERROR,
@@ -79,7 +79,7 @@
form.items.get('host').reset();
form.items.get('port').reset();
form.items.get('username').reset();
- form.items.get('password').reset();
+ form.items.get('_password').reset();
},
onClose: function(e) {
Modified: trunk/deluge/ui/web/json_api.py
===================================================================
--- trunk/deluge/ui/web/json_api.py 2009-03-21 11:15:17 UTC (rev 4906)
+++ trunk/deluge/ui/web/json_api.py 2009-03-21 11:21:05 UTC (rev 4907)
@@ -480,14 +480,20 @@
# if thats the case
for entry in self.host_list["hosts"]:
if (entry[0], entry[1], entry[2]) == (host, port, username):
- d.callback(False)
+ d.callback((False, "Host already in the list"))
+ try:
+ port = int(port)
+ except:
+ d.callback((False, "Port is invalid"))
+ return d
+
# Host isn't in the list, so lets add it
connection_id = hashlib.sha1(str(time.time())).hexdigest()
self.host_list["hosts"].append([connection_id, host, port, username,
password])
self.host_list.save()
- d.callback(True)
+ d.callback((True,))
return d
@export
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---