Revision d1c3c3b3 lib/query.py
b/lib/query.py | ||
---|---|---|
207 | 207 |
|
208 | 208 |
# Verify result |
209 | 209 |
if __debug__: |
210 |
for (idx, row) in enumerate(result): |
|
211 |
assert _VerifyResultRow(self._fields, row), \ |
|
212 |
("Inconsistent result for fields %s in row %s: %r" % |
|
213 |
(GetAllFields(self._fields), idx, row)) |
|
210 |
for row in result: |
|
211 |
_VerifyResultRow(self._fields, row) |
|
214 | 212 |
|
215 | 213 |
return result |
216 | 214 |
|
... | ... | |
256 | 254 |
@param row: Row data |
257 | 255 |
|
258 | 256 |
""" |
259 |
return (len(row) == len(fields) and |
|
260 |
compat.all((status == QRFS_NORMAL and _VERIFY_FN[fdef.kind](value)) or |
|
261 |
# Value for an abnormal status must be None |
|
262 |
(status != QRFS_NORMAL and value is None) |
|
263 |
for ((status, value), (fdef, _, _)) in zip(row, fields))) |
|
257 |
assert len(row) == len(fields) |
|
258 |
errs = [] |
|
259 |
for ((status, value), (fdef, _, _)) in zip(row, fields): |
|
260 |
if status == QRFS_NORMAL: |
|
261 |
if not _VERIFY_FN[fdef.kind](value): |
|
262 |
errs.append("normal field %s fails validation (value is %s)" % |
|
263 |
(fdef.name, value)) |
|
264 |
elif value is not None: |
|
265 |
errs.append("abnormal field %s has a non-None value" % fdef.name) |
|
266 |
assert not errs, ("Failed validation: %s in row %s" % |
|
267 |
(utils.CommaJoin(errors), row)) |
|
264 | 268 |
|
265 | 269 |
|
266 | 270 |
def _PrepareFieldList(fields): |
Also available in: Unified diff