paramecio2fm/paramecio2/libraries/load_apps.py
2023-11-23 23:44:12 +01:00

32 lines
668 B
Python

import csv
import os
"""Simple function for add new modules using a simple csv text
Args:
apps (dict): Dict with modules apps.
Returns:
apps (dict): Dict with the extra modules from extra_apps.txt csv file.
"""
def load_extra_modules(apps):
file_extra_apps='settings/extra_apps.txt'
if os.path.isfile(file_extra_apps):
with open(file_extra_apps, newline='') as csvfile:
spamreader=csv.reader(csvfile, delimiter='|')
for row in spamreader:
apps[row[0]]=row[1:]
if 'admin' in apps:
apps['admin']=apps.pop('admin')
return apps