Added loads_apps
This commit is contained in:
parent
9092d57020
commit
8673bfd40c
2 changed files with 35 additions and 3 deletions
32
paramecio2/libraries/load_apps.py
Normal file
32
paramecio2/libraries/load_apps.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue