Refactory render

This commit is contained in:
Mauricio Baeza 2020-11-09 20:33:34 -06:00
parent 7d33ae28b3
commit cfb99b335c
2 changed files with 6 additions and 6 deletions

View File

@ -3480,12 +3480,6 @@ def get_size_screen():
return res.strip() return res.strip()
# ~ Export ok
def render(template, data):
s = Template(template)
return s.safe_substitute(**data)
# ~ Export ok # ~ Export ok
def format(template, data): def format(template, data):
""" """

View File

@ -46,6 +46,7 @@ from enum import IntEnum
from functools import wraps from functools import wraps
from pathlib import Path from pathlib import Path
from pprint import pprint from pprint import pprint
from string import Template
from typing import Any from typing import Any
import smtplib import smtplib
@ -666,6 +667,11 @@ def get_epoch():
return int(time.mktime(n.timetuple())) return int(time.mktime(n.timetuple()))
def render(template, data):
s = Template(template)
return s.safe_substitute(**data)
def _get_key(password): def _get_key(password):
from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC