From 5317d3210ba866bb9465d9dccc02aa3b3012fc24 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Sun, 21 Jun 2015 21:00:10 -0300 Subject: [PATCH] Fix field annotation code --- legacy/scripts/field_mappings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/legacy/scripts/field_mappings.py b/legacy/scripts/field_mappings.py index 485db7165..3e397de6f 100644 --- a/legacy/scripts/field_mappings.py +++ b/legacy/scripts/field_mappings.py @@ -6,6 +6,10 @@ from collections import OrderedDict from migration_base import appconfs, legacy_app +def is_unannotated_field_line(line): + return not line.strip().startswith('#') and ' = ' in line and ' # ' not in line + + def is_field_line(line): return not line.strip().startswith('#') and ' = ' in line and ' # ' in line @@ -22,7 +26,7 @@ def print_commented_source(model): cols = max(map(len, [line for line in lines if is_field_line(line)])) print '\n' for line in lines: - if not is_field_line(line): + if not is_unannotated_field_line(line): print line.rstrip() else: print '%s # %s' % (line.rstrip().ljust(cols), new_to_old[get_field(line)])