From 917bfb841effed584a5fa62d81762f65f0229d2f Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 26 Jun 2015 13:17:54 -0300 Subject: [PATCH] Ignore already set verbose_name on source rewrite --- legacy/scripts/scrap_original_forms.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/legacy/scripts/scrap_original_forms.py b/legacy/scripts/scrap_original_forms.py index 024fe077c..e64ffacf4 100644 --- a/legacy/scripts/scrap_original_forms.py +++ b/legacy/scripts/scrap_original_forms.py @@ -90,7 +90,7 @@ def source_with_verbose_names(model): source = getsourcelines(model)[0] title, labels, non_matched = extract_verbose_names(model) - field_regex = ' *(.+) = (models\..*)\((.*)\)' + field_regex = ' *(.+) = (models\.[^\(]*)\((.*verbose_name=_\(.*\)|.*)\)' new_lines = [] class_meta_already_exists = False for line in source[1:]: @@ -102,10 +102,10 @@ def source_with_verbose_names(model): name, path, args, legacy_name = split(match.groups()) if name in labels and 'verbose_name' not in args: args = [args] if args.strip() else [] - args.append("verbose_name=_(u'%s')" % labels[name]) - args = ', '.join(args) + args.append(u"verbose_name=_(u'%s')" % labels[name]) + args = u', '.join(args) new_lines.append( - (' %s = %s(%s)' % (name, path, args), legacy_name)) + (u' %s = %s(%s)' % (name, path, args), legacy_name)) break else: if 'class Meta:' in line: