From 7e8c6eb50b1e2c5a2f6e60057b2bd8a7da11c4e9 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Fri, 17 Aug 2007 12:06:11 -0700 Subject: [PATCH] tahoe_put.py: require node-url to be provided --- src/allmydata/scripts/tahoe_put.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/allmydata/scripts/tahoe_put.py b/src/allmydata/scripts/tahoe_put.py index 0bdc8b2b..4b0497af 100644 --- a/src/allmydata/scripts/tahoe_put.py +++ b/src/allmydata/scripts/tahoe_put.py @@ -4,15 +4,18 @@ import re, socket, sys SERVERURL_RE=re.compile("http://([^:]*)(:([1-9][0-9]*))?") -def put(serverurl, vdrive, vdrive_fname, local_fname, verbosity): +def put(nodeurl, vdrive, vdrive_fname, local_fname, verbosity): """ @param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose @return: a Deferred which eventually fires with the exit code """ - mo = SERVERURL_RE.match(serverurl) + if not isinstance(nodeurl, basestring): + raise ValueError("nodeurl is required to be a string and look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (nodeurl,)) + + mo = SERVERURL_RE.match(nodeurl) if not mo: - raise ValueError("serverurl is required to look like \"http://HOSTNAMEORADDR:PORT\"") + raise ValueError("nodeurl is required to look like \"http://HOSTNAMEORADDR:PORT\", not: %r" % (nodeurl,)) host = mo.group(1) port = int(mo.group(3)) -- 2.45.2