Commit 66122ecd39648f7856e5fa0f929f71da6df63b88

Authored by hitier
1 parent 48c6f9a0

New PDC_DB_DATA_DIR config key

and change the db-resource dir name
app/commands/commands.py
@@ -521,7 +521,7 @@ def fake_lesia_names(): @@ -521,7 +521,7 @@ def fake_lesia_names():
521 # 521 #
522 # 1- projects 522 # 1- projects
523 # 523 #
524 - fake_projects_file = os.path.join(current_app.config['PDC_RESOURCES_DIR'], 'fake-db-names', 'fake-projects.txt') 524 + fake_projects_file = os.path.join(current_app.config['PDC_DB_DATA_DIR'], 'fake-projects.txt')
525 with open(fake_projects_file, newline='') as csvfile: 525 with open(fake_projects_file, newline='') as csvfile:
526 spamreader = csv.reader(csvfile, delimiter=';', quotechar='|') 526 spamreader = csv.reader(csvfile, delimiter=';', quotechar='|')
527 fake_projects_names = [', '.join(row) for row in spamreader] 527 fake_projects_names = [', '.join(row) for row in spamreader]
@@ -529,8 +529,7 @@ def fake_lesia_names(): @@ -529,8 +529,7 @@ def fake_lesia_names():
529 529
530 # 2- functions/capacities 530 # 2- functions/capacities
531 # 531 #
532 - fake_capacities_file = os.path.join(current_app.config['PDC_RESOURCES_DIR'], 'fake-db-names',  
533 - 'fake-capacities.txt') 532 + fake_capacities_file = os.path.join(current_app.config['PDC_DB_DATA_DIR'], 'fake-capacities.txt')
534 with open(fake_capacities_file, newline='') as csvfile: 533 with open(fake_capacities_file, newline='') as csvfile:
535 spamreader = csv.reader(csvfile, delimiter=';', quotechar='|') 534 spamreader = csv.reader(csvfile, delimiter=';', quotechar='|')
536 fake_capacities_names = [row for [row] in spamreader] 535 fake_capacities_names = [row for [row] in spamreader]
@@ -538,8 +537,7 @@ def fake_lesia_names(): @@ -538,8 +537,7 @@ def fake_lesia_names():
538 537
539 # 3- services 538 # 3- services
540 # 539 #
541 - fake_services_file = os.path.join(current_app.config['PDC_RESOURCES_DIR'], 'fake-db-names',  
542 - 'fake-services.txt') 540 + fake_services_file = os.path.join(current_app.config['PDC_DB_DATA_DIR'], 'fake-services.txt')
543 with open(fake_services_file, newline='') as csvfile: 541 with open(fake_services_file, newline='') as csvfile:
544 spamreader = csv.reader(csvfile, delimiter=';', quotechar='|') 542 spamreader = csv.reader(csvfile, delimiter=';', quotechar='|')
545 fake_services_names = [row for row in spamreader] 543 fake_services_names = [row for row in spamreader]
resources/fake-db-names/fake-capacities.txt renamed to resources/db-contents/fake-capacities.txt
resources/fake-db-names/fake-projects.txt renamed to resources/db-contents/fake-projects.txt
resources/fake-db-names/fake-services.txt renamed to resources/db-contents/fake-services.txt
resources/pdc_config.py
@@ -26,6 +26,7 @@ class Config(object): @@ -26,6 +26,7 @@ class Config(object):
26 PDC_LOGS_DIR = os.path.join(PDC_ROOT_DIR, 'logs') 26 PDC_LOGS_DIR = os.path.join(PDC_ROOT_DIR, 'logs')
27 PDC_LOGS_FILE = os.path.join(PDC_LOGS_DIR, 'pdc.log') 27 PDC_LOGS_FILE = os.path.join(PDC_LOGS_DIR, 'pdc.log')
28 PDC_RESOURCES_DIR = os.path.join(PDC_ROOT_DIR, 'resources') 28 PDC_RESOURCES_DIR = os.path.join(PDC_ROOT_DIR, 'resources')
  29 + PDC_DB_DATA_DIR = os.path.join(PDC_RESOURCES_DIR, 'db-contents')
29 30
30 # Uncomment for role access control 31 # Uncomment for role access control
31 # 32 #