15
15
from moban .core .hashstore import HASH_STORE
16
16
from moban .externals .buffered_writer import BufferedWriter
17
17
18
- log = logging .getLogger (__name__ )
18
+ LOG = logging .getLogger (__name__ )
19
19
PY3_ABOVE = sys .version_info [0 ] > 2
20
20
21
21
@@ -29,7 +29,7 @@ def register_extensions(self, extensions):
29
29
for user_template_type in extensions .keys ():
30
30
template_type = self .get_primary_key (user_template_type )
31
31
32
- log .debug (
32
+ LOG .debug (
33
33
"Registering extensions: {0}={1}" .format (
34
34
user_template_type , extensions [user_template_type ]
35
35
)
@@ -92,14 +92,26 @@ def __init__(self, template_fs, context_dirs, engine):
92
92
self .templated_count = 0
93
93
self .file_count = 0
94
94
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
+ )
95
105
96
106
def report (self ):
97
107
if self .templated_count == 0 :
98
108
reporter .report_no_action ()
99
109
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 )
101
111
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
+ )
103
115
104
116
def number_of_templated_files (self ):
105
117
return self .templated_count
@@ -119,7 +131,9 @@ def render_to_file(self, template_file, data_file, output_file):
119
131
template_abs_path , template , data , output_file
120
132
)
121
133
if flag :
122
- reporter .report_templating (template_file , output_file )
134
+ reporter .report_templating (
135
+ self .engine_action , template_file , output_file
136
+ )
123
137
self .templated_count += 1
124
138
self .buffered_writer .close ()
125
139
@@ -133,7 +147,9 @@ def render_string_to_file(
133
147
template_abs_path , template , data , output_file
134
148
)
135
149
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
+ )
137
153
self .templated_count += 1
138
154
self .buffered_writer .close ()
139
155
@@ -159,7 +175,7 @@ def apply_template(self, template_abs_path, template, data, output_file):
159
175
return flag
160
176
except exceptions .FileNotFound :
161
177
# 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 ))
163
179
self .buffered_writer .write_file_out (output_file , rendered_content )
164
180
return True
165
181
@@ -186,7 +202,9 @@ def _render_with_finding_template_first(self, template_file_index):
186
202
template_abs_path , template , data , output
187
203
)
188
204
if flag :
189
- reporter .report_templating (template_file , output )
205
+ reporter .report_templating (
206
+ self .engine_action , template_file , output
207
+ )
190
208
self .templated_count += 1
191
209
self .file_count += 1
192
210
@@ -202,13 +220,15 @@ def _render_with_finding_data_first(self, data_file_index):
202
220
template_abs_path , template , data , output
203
221
)
204
222
if flag :
205
- reporter .report_templating (template_file , output )
223
+ reporter .report_templating (
224
+ self .engine_action , template_file , output
225
+ )
206
226
self .templated_count += 1
207
227
self .file_count += 1
208
228
209
229
210
230
def expand_template_directories (dirs ):
211
- log .debug ("Expanding %s..." % dirs )
231
+ LOG .debug ("Expanding %s..." % dirs )
212
232
if not isinstance (dirs , list ):
213
233
dirs = [dirs ]
214
234
@@ -217,7 +237,7 @@ def expand_template_directories(dirs):
217
237
218
238
219
239
def expand_template_directory (directory ):
220
- log .debug ("Expanding %s..." % directory )
240
+ LOG .debug ("Expanding %s..." % directory )
221
241
translated_directory = None
222
242
if ":" in directory and directory [1 ] != ":" and "://" not in directory :
223
243
translated_directory = deprecated_moban_path_notation (directory )
0 commit comments