From ed973dbcf2c3a94274e94eeebeb591c4d48f62a0 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 19 Jan 2015 17:12:36 +0100 Subject: [PATCH] Project handler use ProjectManager --- docs/api/examples/post_project.txt | 8 ++++---- gns3server/handlers/project_handler.py | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/api/examples/post_project.txt b/docs/api/examples/post_project.txt index 6312959f..ab6d97fc 100644 --- a/docs/api/examples/post_project.txt +++ b/docs/api/examples/post_project.txt @@ -1,8 +1,8 @@ -curl -i -xPOST 'http://localhost:8000/project' -d '{"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-240/test_create_project_with_dir0"}' +curl -i -xPOST 'http://localhost:8000/project' -d '{"location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-253/test_create_project_with_dir0"}' POST /project HTTP/1.1 { - "location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-240/test_create_project_with_dir0" + "location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-253/test_create_project_with_dir0" } @@ -15,6 +15,6 @@ SERVER: Python/3.4 aiohttp/0.13.1 X-ROUTE: /project { - "location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-240/test_create_project_with_dir0", - "uuid": "16c371ee-728c-4bb3-8062-26b9313bd67d" + "location": "/private/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/pytest-253/test_create_project_with_dir0", + "uuid": "a8984692-a820-45de-8d4d-fc006b29072a" } diff --git a/gns3server/handlers/project_handler.py b/gns3server/handlers/project_handler.py index 6fbaa4b0..77a4b835 100644 --- a/gns3server/handlers/project_handler.py +++ b/gns3server/handlers/project_handler.py @@ -17,7 +17,7 @@ from ..web.route import Route from ..schemas.project import PROJECT_OBJECT_SCHEMA -from ..modules.project import Project +from ..modules.project_manager import ProjectManager from aiohttp.web import HTTPConflict @@ -29,6 +29,9 @@ class ProjectHandler: output=PROJECT_OBJECT_SCHEMA, input=PROJECT_OBJECT_SCHEMA) def create_project(request, response): - p = Project(location = request.json.get("location"), - uuid = request.json.get("uuid")) + pm = ProjectManager.instance() + p = pm.create_project( + location = request.json.get("location"), + uuid = request.json.get("uuid") + ) response.json(p)