From 51af1fa2e3be5d8d70837f78291a86fe0f261712 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 5 Dec 2007 00:15:13 -0700
Subject: [PATCH] webish: fix overwrite form display

---
 src/allmydata/test/test_web.py    | 5 +++--
 src/allmydata/web/directory.xhtml | 2 +-
 src/allmydata/webish.py           | 3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index f051ee04..300018a2 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -948,8 +948,9 @@ class Web(WebMixin, unittest.TestCase):
                       self.GET(self.public_url + "/foo",
                                followRedirect=True))
         def _check_page(res):
-            # TODO: assert something about the contents
-            pass
+            # TODO: assert more about the contents
+            self.failUnless("Overwrite" in res)
+            self.failUnless("Choose new file:" in res)
         d.addCallback(_check_page)
 
         return d
diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml
index 63b64ed5..99cf926a 100644
--- a/src/allmydata/web/directory.xhtml
+++ b/src/allmydata/web/directory.xhtml
@@ -40,7 +40,7 @@
     <td><n:slot name="size"/></td>
     <td><n:slot name="data"/></td>
     <td><n:slot name="delete"/></td>
-    <td><div n:render="overwrite"/></td>
+    <td><n:slot name="overwrite"/></td>
     <td><n:slot name="rename"/></td>
 
     <td><n:slot name="check"/></td>
diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py
index c20403a4..6353dbeb 100644
--- a/src/allmydata/webish.py
+++ b/src/allmydata/webish.py
@@ -176,6 +176,7 @@ class Directory(rend.Page):
             T.input(type='hidden', name='when_done', value=url.here),
             T.input(type='submit', value='check', name="check"),
             ]
+        ctx.fillSlots("overwrite", self.build_overwrite(ctx, (name, target)))
         ctx.fillSlots("check", check)
 
         # build the base of the uri_link link url
@@ -331,7 +332,7 @@ class Directory(rend.Page):
                 T.div(class_="freeform-form")[mount],
                 ]
 
-    def render_overwrite(self, ctx, data):
+    def build_overwrite(self, ctx, data):
         name, target = data
         if IMutableFileNode.providedBy(target) and not target.is_readonly():
             overwrite = T.form(action=".", method="post",
-- 
2.45.2