From: Brian Warner <warner@lothar.com>
Date: Sat, 15 Sep 2007 19:49:07 +0000 (-0700)
Subject: webish: upload: when the localdir= doesn't exist, say so in the HTTP response
X-Git-Tag: allmydata-tahoe-0.6.0~109
X-Git-Url: https://git.rkrishnan.org/components/something?a=commitdiff_plain;h=d5ed60e4add666b9b526a156035b4fb72e536ddc;p=tahoe-lafs%2Ftahoe-lafs.git

webish: upload: when the localdir= doesn't exist, say so in the HTTP response
---

diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py
index 6d1fa382..9b6639e2 100644
--- a/src/allmydata/webish.py
+++ b/src/allmydata/webish.py
@@ -833,6 +833,9 @@ class PUTHandler(rend.Page):
         # build up a list of files to upload
         all_files = []
         all_dirs = []
+        msg = "No files to upload! %s is empty" % localdir
+        if not os.path.exists(localdir):
+            msg = "%s doesn't exist!" % localdir
         for root, dirs, files in os.walk(localdir):
             if root == localdir:
                 path = ()
@@ -843,7 +846,7 @@ class PUTHandler(rend.Page):
                 all_dirs.append(path + (d,))
             for f in files:
                 all_files.append(path + (f,))
-        d = defer.succeed(None)
+        d = defer.succeed(msg)
         for dir in all_dirs:
             if dir:
                 d.addCallback(self._makedir, node, dir)