Added loads_apps

This commit is contained in:
absurdo 2023-11-23 23:44:12 +01:00
parent 9092d57020
commit 8673bfd40c
2 changed files with 35 additions and 3 deletions

View file

@ -339,7 +339,7 @@ def start():
# Installing models
padmin='padmin.py'
padmin='paramecio2db'
os.chmod(padmin, 0o755)
@ -359,7 +359,7 @@ def start():
if m.match(f) and not underscore.match(f):
if call('./padmin.py --model '+models_path+'/'+f, shell=True) > 0:
if call('paramecio2db --model '+models_path+'/'+f, shell=True) > 0:
print('Error, cannot create the modules of '+models_path+'/'+f)
else:
print('Models from '+models_path+'/'+f+' created')
@ -385,7 +385,7 @@ def start():
exit(1)
else:
print('Postinstall script finished')
"""
conn.close()
if __name__=="__main__":

View 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