Software /
code /
prosody
Comparison
util/dataforms.lua @ 4886:26d8e4665ce9
util.dataforms: Fix validation of booleans.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 17 May 2012 21:18:35 +0200 |
parent | 4884:b8d852aea3ad |
child | 4887:4dd61fe04db4 |
comparison
equal
deleted
inserted
replaced
4885:8df3e709f8b7 | 4886:26d8e4665ce9 |
---|---|
212 local raw_value = field_tag:get_child_text("value"); | 212 local raw_value = field_tag:get_child_text("value"); |
213 local value = boolean_values[raw_value ~= nil and raw_value]; | 213 local value = boolean_values[raw_value ~= nil and raw_value]; |
214 if value ~= nil then | 214 if value ~= nil then |
215 return value; | 215 return value; |
216 elseif raw_value then | 216 elseif raw_value then |
217 return "Invalid boolean representation"; | 217 return nil, "Invalid boolean representation"; |
218 elseif required then | 218 elseif required then |
219 return nil, "Required value missing"; | 219 return nil, "Required value missing"; |
220 end | 220 end |
221 end | 221 end |
222 | 222 |