22# Gramps Web API - A RESTful API for the Gramps genealogy program
33#
44# Copyright (C) 2020 Christopher Horn
5+ # Copyright (C) 2023 David Straub
56#
67# This program is free software; you can redistribute it and/or modify
78# it under the terms of the GNU Affero General Public License as published by
1920
2021"""Metadata API resource."""
2122
22- import yaml
23- from flask import Response
23+ from flask import current_app , Response
2424from gramps .cli .clidbman import CLIDbManager
2525from gramps .gen .const import ENV , GRAMPS_LOCALE
2626from gramps .gen .db .base import DbReadBase
2727from gramps .gen .dbstate import DbState
2828from gramps .gen .utils .grampslocale import INCOMPLETE_TRANSLATIONS
29- from pkg_resources import resource_filename
3029
31- from gramps_webapi .const import VERSION
30+ from gramps_webapi .const import TREE_MULTI , VERSION
3231
3332from ..util import get_db_handle
3433from . import ProtectedResource
@@ -62,11 +61,23 @@ def get(self) -> Response:
6261 if key == db_key :
6362 db_type = db_summary [0 ][key ]
6463
64+ is_multi_tree = current_app .config ["TREE" ] == TREE_MULTI
65+ has_task_queue = bool (current_app .config ["CELERY_CONFIG" ])
66+
6567 result = {
66- "database" : {"id" : db_handle .get_dbid (), "name" : db_name , "type" : db_type ,},
68+ "database" : {
69+ "id" : db_handle .get_dbid (),
70+ "name" : db_name ,
71+ "type" : db_type ,
72+ },
6773 "default_person" : db_handle .get_default_handle (),
68- "gramps" : {"version" : ENV ["VERSION" ],},
69- "gramps_webapi" : {"schema" : VERSION , "version" : VERSION ,},
74+ "gramps" : {
75+ "version" : ENV ["VERSION" ],
76+ },
77+ "gramps_webapi" : {
78+ "schema" : VERSION ,
79+ "version" : VERSION ,
80+ },
7081 "locale" : {
7182 "lang" : GRAMPS_LOCALE .lang ,
7283 "language" : GRAMPS_LOCALE .language [0 ],
@@ -88,6 +99,7 @@ def get(self) -> Response:
8899 "tags" : db_handle .get_number_of_tags (),
89100 },
90101 "researcher" : db_handle .get_researcher (),
102+ "server" : {"multi_tree" : is_multi_tree , "task_queue" : has_task_queue },
91103 "surnames" : db_handle .get_surname_list (),
92104 }
93105 data = db_handle .get_summary ()
0 commit comments