109 | | server = xmlrpclib.ServerProxy("http://%s:%s" % (destination, port)) |
110 | | if options["ask"] : |
111 | | labels = [] |
112 | | varnames = [] |
113 | | varvalues = {} |
114 | | for arg in arguments : |
115 | | try : |
116 | | (label, varname, varvalue) = arg.split(":", 2) |
117 | | except ValueError : |
118 | | raise PyKotaCommandLineError, "argument '%s' is invalid !" % arg |
119 | | labels.append(self.sanitizeMessage(label)) |
120 | | varname = varname.lower() |
121 | | varnames.append(varname) |
122 | | varvalues[varname] = self.sanitizeMessage(varvalue) |
123 | | result = server.askDatas(labels, varnames, varvalues) |
124 | | if result["isValid"] : |
125 | | for varname in varnames : |
126 | | print "%s=%s" % (varname.upper(), result[varname]) |
127 | | elif options["confirm"] : |
128 | | print server.showDialog(self.sanitizeMessage(arguments[0]), True) |
129 | | elif options["notify"] : |
130 | | print server.showDialog(self.sanitizeMessage(arguments[0]), False) |
131 | | |
132 | | if options["quit"] : |
133 | | server.quitApplication() |
| 110 | try : |
| 111 | server = xmlrpclib.ServerProxy("http://%s:%s" % (destination, port)) |
| 112 | if options["ask"] : |
| 113 | labels = [] |
| 114 | varnames = [] |
| 115 | varvalues = {} |
| 116 | for arg in arguments : |
| 117 | try : |
| 118 | (label, varname, varvalue) = arg.split(":", 2) |
| 119 | except ValueError : |
| 120 | raise PyKotaCommandLineError, "argument '%s' is invalid !" % arg |
| 121 | labels.append(self.sanitizeMessage(label)) |
| 122 | varname = varname.lower() |
| 123 | varnames.append(varname) |
| 124 | varvalues[varname] = self.sanitizeMessage(varvalue) |
| 125 | result = server.askDatas(labels, varnames, varvalues) |
| 126 | if result["isValid"] : |
| 127 | for varname in varnames : |
| 128 | print "%s=%s" % (varname.upper(), result[varname]) |
| 129 | elif options["confirm"] : |
| 130 | print server.showDialog(self.sanitizeMessage(arguments[0]), True) |
| 131 | elif options["notify"] : |
| 132 | print server.showDialog(self.sanitizeMessage(arguments[0]), False) |
| 133 | |
| 134 | if options["quit"] : |
| 135 | server.quitApplication() |
| 136 | except (socket.error, socket.gaierror), msg : |
| 137 | raise PyKotaCommandLineError, "%s : %s" % (_("Connexion error"), str(msg)) |