1515from moban .core .hashstore import HASH_STORE
1616from moban .externals .buffered_writer import BufferedWriter
1717
18- log = logging .getLogger (__name__ )
18+ LOG = logging .getLogger (__name__ )
1919PY3_ABOVE = sys .version_info [0 ] > 2
2020
2121
@@ -29,7 +29,7 @@ def register_extensions(self, extensions):
2929 for user_template_type in extensions .keys ():
3030 template_type = self .get_primary_key (user_template_type )
3131
32- log .debug (
32+ LOG .debug (
3333 "Registering extensions: {0}={1}" .format (
3434 user_template_type , extensions [user_template_type ]
3535 )
@@ -92,14 +92,26 @@ def __init__(self, template_fs, context_dirs, engine):
9292 self .templated_count = 0
9393 self .file_count = 0
9494 self .buffered_writer = BufferedWriter ()
95+ self .engine_action = getattr (
96+ engine ,
97+ "ACTION_IN_PRESENT_CONTINUOUS_TENSE" ,
98+ constants .LABEL_MOBAN_ACTION_IN_PRESENT_CONTINUOUS_TENSE ,
99+ )
100+ self .engine_actioned = getattr (
101+ engine ,
102+ "ACTION_IN_PAST_TENSE" ,
103+ constants .LABEL_MOBAN_ACTION_IN_PAST_TENSE ,
104+ )
95105
96106 def report (self ):
97107 if self .templated_count == 0 :
98108 reporter .report_no_action ()
99109 elif self .templated_count == self .file_count :
100- reporter .report_full_run (self .file_count )
110+ reporter .report_full_run (self .engine_actioned , self . file_count )
101111 else :
102- reporter .report_partial_run (self .templated_count , self .file_count )
112+ reporter .report_partial_run (
113+ self .engine_actioned , self .templated_count , self .file_count
114+ )
103115
104116 def number_of_templated_files (self ):
105117 return self .templated_count
@@ -119,7 +131,9 @@ def render_to_file(self, template_file, data_file, output_file):
119131 template_abs_path , template , data , output_file
120132 )
121133 if flag :
122- reporter .report_templating (template_file , output_file )
134+ reporter .report_templating (
135+ self .engine_action , template_file , output_file
136+ )
123137 self .templated_count += 1
124138 self .buffered_writer .close ()
125139
@@ -133,7 +147,9 @@ def render_string_to_file(
133147 template_abs_path , template , data , output_file
134148 )
135149 if flag :
136- reporter .report_templating (template_abs_path , output_file )
150+ reporter .report_templating (
151+ self .engine_action , template_abs_path , output_file
152+ )
137153 self .templated_count += 1
138154 self .buffered_writer .close ()
139155
@@ -159,7 +175,7 @@ def apply_template(self, template_abs_path, template, data, output_file):
159175 return flag
160176 except exceptions .FileNotFound :
161177 # the template is a string from command line
162- log .info ("{} is not a file" .format (template_abs_path ))
178+ LOG .info ("{} is not a file" .format (template_abs_path ))
163179 self .buffered_writer .write_file_out (output_file , rendered_content )
164180 return True
165181
@@ -186,7 +202,9 @@ def _render_with_finding_template_first(self, template_file_index):
186202 template_abs_path , template , data , output
187203 )
188204 if flag :
189- reporter .report_templating (template_file , output )
205+ reporter .report_templating (
206+ self .engine_action , template_file , output
207+ )
190208 self .templated_count += 1
191209 self .file_count += 1
192210
@@ -202,13 +220,15 @@ def _render_with_finding_data_first(self, data_file_index):
202220 template_abs_path , template , data , output
203221 )
204222 if flag :
205- reporter .report_templating (template_file , output )
223+ reporter .report_templating (
224+ self .engine_action , template_file , output
225+ )
206226 self .templated_count += 1
207227 self .file_count += 1
208228
209229
210230def expand_template_directories (dirs ):
211- log .debug ("Expanding %s..." % dirs )
231+ LOG .debug ("Expanding %s..." % dirs )
212232 if not isinstance (dirs , list ):
213233 dirs = [dirs ]
214234
@@ -217,7 +237,7 @@ def expand_template_directories(dirs):
217237
218238
219239def expand_template_directory (directory ):
220- log .debug ("Expanding %s..." % directory )
240+ LOG .debug ("Expanding %s..." % directory )
221241 translated_directory = None
222242 if ":" in directory and directory [1 ] != ":" and "://" not in directory :
223243 translated_directory = deprecated_moban_path_notation (directory )
0 commit comments