API for listing current projects

Fix #274
This commit is contained in:
Julien Duponchelle committed 2015-07-24 10:09:16 +02:00
1 parent cbe593f4a4
commit d9f1a7c7d3
4 files changed
+47 -1

No files matched your search

+16 -1
View File
@@ -21,7 +21,7 @@ import json
import os
from ...web.route import Route
from ...schemas.project import PROJECT_OBJECT_SCHEMA, PROJECT_CREATE_SCHEMA, PROJECT_UPDATE_SCHEMA, PROJECT_FILE_LIST_SCHEMA
from ...schemas.project import PROJECT_OBJECT_SCHEMA, PROJECT_CREATE_SCHEMA, PROJECT_UPDATE_SCHEMA, PROJECT_FILE_LIST_SCHEMA, PROJECT_LIST_SCHEMA
from ...modules.project_manager import ProjectManager
from ...modules import MODULES
from ...utils.asyncio import wait_run_in_executor
@@ -35,6 +35,21 @@ class ProjectHandler:
# How many clients has subcribe to notifications
_notifications_listening = 0
@classmethod
@Route.get(
r"/projects",
description="List projects opened on the server",
status_codes={
200: "Project list",
}
# output=PROJECT_LIST_SCHEMA)
)
def list_projects(request, response):
pm = ProjectManager.instance()
response.set_status(200)
response.json(list(pm.projects))
@classmethod
@Route.post(
r"/projects",