Organize global substitution code

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-11-10 01:01:17 -04:00
parent 680a4875f5
commit 15dc4e8489
5 changed files with 86 additions and 67 deletions

21
docs/utils.py Normal file
View File

@@ -0,0 +1,21 @@
from __future__ import unicode_literals
def load_env_file(filename='../config.env'):
result = {}
with open(filename) as file_object:
for line in file_object:
if not line.startswith('#'):
key, value = line.strip().split('=')
result[key] = value
return result
def generate_substitutions(dictionary):
result = []
for key, value in dictionary.items():
result.append(('|{}|'.format(key), value))
return result