diff --git a/pilot/helpers/Project.py b/pilot/helpers/Project.py index 9aa92a1..90d3099 100644 --- a/pilot/helpers/Project.py +++ b/pilot/helpers/Project.py @@ -1,7 +1,7 @@ import os from termcolor import colored -from const.common import IGNORE_FOLDERS +from const.common import IGNORE_FOLDERS, STEPS from database.models.app import App from database.database import get_app, delete_unconnected_steps_from, delete_all_app_development_data from utils.questionary import styled_text @@ -80,6 +80,11 @@ class Project: # self.development_plan = self.tech_lead.create_development_plan() # TODO move to constructor eventually + if self.args['step'] is not None and STEPS.index(self.args['step']) < STEPS.index('coding'): + clear_directory(self.root_path) + delete_all_app_development_data(self.args['app_id']) + self.skip_steps = False + if 'skip_until_dev_step' in self.args: self.skip_until_dev_step = self.args['skip_until_dev_step'] if self.args['skip_until_dev_step'] == '0': diff --git a/pilot/utils/utils.py b/pilot/utils/utils.py index 771dafb..1a378cd 100644 --- a/pilot/utils/utils.py +++ b/pilot/utils/utils.py @@ -135,6 +135,7 @@ def hash_data(data): serialized_data = json.dumps(replace_functions(data), sort_keys=True).encode('utf-8') return hashlib.sha256(serialized_data).hexdigest() + def replace_functions(obj): if isinstance(obj, dict): return {k: replace_functions(v) for k, v in obj.items()} @@ -145,12 +146,14 @@ def replace_functions(obj): else: return obj + def fix_json(s): s = s.replace('True', 'true') s = s.replace('False', 'false') # s = s.replace('`', '"') return fix_json_newlines(s) + def fix_json_newlines(s): pattern = r'("(?:\\\\n|\\.|[^"\\])*")' @@ -159,6 +162,7 @@ def fix_json_newlines(s): return re.sub(pattern, replace_newlines, s) + def clean_filename(filename): # Remove invalid characters cleaned_filename = re.sub(r'[<>:"/\\|?*]', '', filename)