Diff

util/dataforms.lua @ 5693:ef490e9276df

util.dataforms: Return nil for empty list-mutli responses, to be consistent with other readers
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 14 Jun 2013 00:07:57 +0200
parent 5551:e1e06f1465be
child 5776:bd0ff8ae98a8
child 6148:7dcd6f124c93
line wrap: on
line diff
--- a/util/dataforms.lua	Thu Jun 13 13:56:35 2013 +0100
+++ b/util/dataforms.lua	Fri Jun 14 00:07:57 2013 +0200
@@ -187,7 +187,11 @@
 		for value in field_tag:childtags("value") do
 			result[#result+1] = value:get_text();
 		end
-		return result, (required and #result == 0 and "Required value missing" or nil);
+		if #result > 0 then
+			return result;
+		elseif required then
+			return nil, "Required value missing";
+		end
 	end
 
 field_readers["text-multi"] =