From 86cbcecb5991af7acaaa5371eec1277ae3be2ef4 Mon Sep 17 00:00:00 2001 From: Kun Huang Date: Sat, 20 Jul 2013 08:40:42 +0800 Subject: [PATCH] remove assert syntax assert is not a good tool for checking common mistakes, but could be used test conditions that `should never happen` (there're many talks about it) Change-Id: Iccf9710008293465bb9bb59e65f0ed77d7910688 --- swift/obj/diskfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swift/obj/diskfile.py b/swift/obj/diskfile.py index cdfb4c50c2..f9efa9a609 100644 --- a/swift/obj/diskfile.py +++ b/swift/obj/diskfile.py @@ -121,7 +121,8 @@ class DiskWriter(object): :param metadata: dictionary of metadata to be written :param extension: extension to be used when making the file """ - assert self.tmppath is not None + if not self.tmppath: + raise ValueError("tmppath is unusable.") timestamp = normalize_timestamp(metadata['X-Timestamp']) metadata['name'] = self.disk_file.name