Skip to content

Commit

Permalink
swancontents: fix creating projects with a given name
Browse files Browse the repository at this point in the history
  • Loading branch information
diocas authored and etejedor committed Jul 5, 2024
1 parent 02bf1ae commit ec4400a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SwanContents/swancontents/filemanager/projects_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ec4400a

Please sign in to comment.