From 92bdf14aa1a8830c0d8a7e9505848d36617926b2 Mon Sep 17 00:00:00 2001 From: Dan McDougall Date: Fri, 6 Feb 2015 13:36:17 -0500 Subject: [PATCH] minification.py: Fixed the bug reported in issue #34 where multiple decorators on the same function were not being indented properly. --- pyminifier/minification.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyminifier/minification.py b/pyminifier/minification.py index f4b0b66..384ba02 100644 --- a/pyminifier/minification.py +++ b/pyminifier/minification.py @@ -223,6 +223,10 @@ def foo(foo,bar,blah): # mixed strings using both single quotes and double quotes. out += "'''" + new_string + "'''" joining_strings = False + if token_string == '@': # Decorators need special handling + if prev_tok[0] == tokenize.NEWLINE: + # Ensure it gets indented properly + out += (" " * (start_col - last_col)) if not joining_strings: out += token_string last_col = end_col