harshadyeola
10 years ago
2 changed files with 27 additions and 16 deletions
@ -0,0 +1,19 @@ |
|||
# Based on https://github.com/datafolklabs/cement/issues/295 |
|||
# To avoid encoding releated error,we defined our custom output handler |
|||
# I hope we will remove this when we upgarde to Cement 2.6 (Not released yet) |
|||
|
|||
from cement.ext.ext_mustache import MustacheOutputHandler |
|||
|
|||
|
|||
class EEOutputHandler(MustacheOutputHandler): |
|||
class Meta: |
|||
label = 'ee_output_handler' |
|||
|
|||
def _load_template_from_file(self, path): |
|||
for templ_dir in self.app._meta.template_dirs: |
|||
full_path = fs.abspath(os.path.join(templ_dir, path)) |
|||
if os.path.exists(full_path): |
|||
self.app.log.debug('loading template file %s' % full_path) |
|||
return open(full_path, encoding='utf-8', mode='r').read() |
|||
else: |
|||
continue |
Loading…
Reference in new issue