Add 'only_files' option to the overwrite field in Adder
authorkevan <kevan@isnotajoke.com>
Sat, 18 Jul 2009 03:00:10 +0000 (20:00 -0700)
committerkevan <kevan@isnotajoke.com>
Sat, 18 Jul 2009 03:00:10 +0000 (20:00 -0700)
src/allmydata/dirnode.py

index b06836f323c5d8eec3a8d5b43c6e76a091b8c315..117c80e451189160625e100e00a553f1d7e1cc3d 100644 (file)
@@ -98,6 +98,9 @@ class Adder:
             if name in children:
                 if not self.overwrite:
                     raise ExistingChildError("child '%s' already exists" % name)
+
+                if self.overwrite == "only_files" and IDirectoryNode.providedBy(children[name][0]):
+                    raise ExistingChildError("child '%s' already exists" % name)
                 metadata = children[name][1].copy()
             else:
                 metadata = {"ctime": now,