Hackfut Security File Manager
Current Path:
/usr/lib/python2.6/site-packages/clcommon
usr
/
lib
/
python2.6
/
site-packages
/
clcommon
/
📁
..
📄
__init__.py
(196 B)
📄
__init__.pyc
(491 B)
📄
__init__.pyo
(491 B)
📄
clcagefs.py
(6.16 KB)
📄
clcagefs.pyc
(7.6 KB)
📄
clcagefs.pyo
(7.6 KB)
📄
clconfpars.py
(1.68 KB)
📄
clconfpars.pyc
(2.5 KB)
📄
clconfpars.pyo
(2.5 KB)
📄
cldetect.py
(2.93 KB)
📄
cldetect.pyc
(2.99 KB)
📄
cldetect.pyo
(2.99 KB)
📄
clemail.py
(1.86 KB)
📄
clemail.pyc
(2.07 KB)
📄
clemail.pyo
(2.07 KB)
📄
clfunc.py
(2.5 KB)
📄
clfunc.pyc
(3.36 KB)
📄
clfunc.pyo
(3.36 KB)
📄
clhook.py
(3.55 KB)
📄
clhook.pyc
(3.77 KB)
📄
clhook.pyo
(3.77 KB)
📄
cllog.py
(1.11 KB)
📄
cllog.pyc
(1.83 KB)
📄
cllog.pyo
(1.83 KB)
📄
cloutput.py
(447 B)
📄
cloutput.pyc
(697 B)
📄
cloutput.pyo
(697 B)
📄
clpwd.py
(3.53 KB)
📄
clpwd.pyc
(4.7 KB)
📄
clpwd.pyo
(4.7 KB)
📄
clsec.py
(450 B)
📄
clsec.pyc
(1.21 KB)
📄
clsec.pyo
(1.21 KB)
📁
cpapi
📄
utils.py
(1.45 KB)
📄
utils.pyc
(2.1 KB)
📄
utils.pyo
(2.1 KB)
Editing: clemail.py
# ClEmail - class for generation email messages import os import jinja2 # Subject line prefix in template file SUBJECT_LINE_PREFIX = 'Subject:' class ClEmail: def __init__(self): pass @staticmethod def generate_mail_jinja2(template_dir, templ_filename, templ_data=None, locale_name=None, subject=None): """ Generates email message using jinja2 template engine :param template_dir: Base templates directory :param templ_filename: Template filename :param templ_data: Data to fill template using jinja2 :param locale_name: Locale :param subject: Email subject to use if it not found in template :return: Cortege (email_subject, email_body) """ # default locale is en_US def_locale = 'en_US' locale_name = locale_name or def_locale templ_dir = os.path.join(template_dir, locale_name) if locale_name != def_locale and not os.path.isfile(os.path.join(templ_dir, templ_filename)): templ_dir = os.path.join(template_dir, def_locale) template_file = os.path.join(templ_dir, templ_filename) # Read template file content f_template = open(template_file, "r") template_lines = f_template.readlines() f_template.close() # Search subject string in template content if len(template_lines) > 2 and template_lines[0].startswith(SUBJECT_LINE_PREFIX) and template_lines[1] == '\n': subject = template_lines[0].replace(SUBJECT_LINE_PREFIX, '').strip() # Remove Subject line and separator (empty line) from array template_lines.pop(1) template_lines.pop(0) pass # Create dictionary for jinja2 Dict Loader template_lines = [l.decode('utf-8') for l in template_lines] templ_dict = {templ_filename: ''.join(template_lines)} templ_loader = jinja2.DictLoader(templ_dict) templ_envir = jinja2.Environment(loader=templ_loader) body_message = templ_envir.get_template(templ_filename).render(templ_data) return subject, body_message.encode('utf-8')
Upload File
Create Folder