Use constants for field/flag types

Avoids typos, such as one I just found which was 'strsng' isntead of
'string'. The static analyzer can catch those if they are constants.
Comparing ints is also faster than strings, which adds up in readmeta.
This commit is contained in:
Daniel Martí 2015-12-03 12:55:19 +01:00
parent 992406de0e
commit b1a9180d12
2 changed files with 47 additions and 37 deletions

View file

@ -108,7 +108,7 @@ def check_regexes(app):
for m, r in checks:
v = app.get_field(f)
t = metadata.metafieldtype(f)
if t == 'multiline':
if t == metadata.TYPE_MULTILINE:
for l in v.splitlines():
if m.match(l):
yield "%s at line '%s': %s" % (f, l, r)