From ec4400af2322b6878859f9bfa958bdb144b02120 Mon Sep 17 00:00:00 2001 From: Diogo Castro Date: Fri, 5 Jul 2024 16:04:56 +0200 Subject: [PATCH] swancontents: fix creating projects with a given name --- SwanContents/swancontents/filemanager/projects_mixin.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SwanContents/swancontents/filemanager/projects_mixin.py b/SwanContents/swancontents/filemanager/projects_mixin.py index f06edff2..4195708d 100644 --- a/SwanContents/swancontents/filemanager/projects_mixin.py +++ b/SwanContents/swancontents/filemanager/projects_mixin.py @@ -167,7 +167,14 @@ def save(self, model, path=''): raise web.HTTPError(500, f"Unexpected error while creating a Project: {path} {e}") from e return self.get(path, content=False) - + + def new(self, model=None, path=''): + if model and 'type' in model and 'ext' in model and \ + model['type'] == 'directory' and model['ext'] == 'project': + model['is_project'] = True + model['ext'] = '' + return super().new(model, path) + def new_untitled(self, path='', type='', ext=''): """ Create a new untitled file or directory in path