Skip to content
Snippets Groups Projects
Verified Commit 6307b58a authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Merge branch 'f-fsm' into f-fsm-v0.2

parents 6b83e18b fc79e158
No related branches found
No related tags found
1 merge request!3F fsm
......@@ -9,8 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ###
* Entity State support (experimental). See the `caosdb.State` class for more
information.
* Entity State support (experimental, no StateModel support yet). See the `caosdb.State` class for
more information.
* Versioning support (experimental).
### Changed ###
......
......@@ -31,7 +31,7 @@ from lxml import etree
from caosdb.common.utils import xml2str
from caosdb.connection.connection import get_connection
from caosdb.exceptions import (AuthorizationException, ClientErrorException,
EntityDoesNotExistError)
EntityDoesNotExistError, ServerConfigurationException)
def set_server_property(key, value):
......@@ -52,9 +52,11 @@ def set_server_property(key, value):
None
"""
con = get_connection()
con._form_data_request(method="POST", path="_server_properties",
params={key: value}).read()
try:
con._form_data_request(method="POST", path="_server_properties",
params={key: value}).read()
except EntityDoesNotExistError:
raise ServerConfigurationException("Debug mode in server is probably disabled.") from None
def get_server_properties():
......@@ -68,7 +70,11 @@ def get_server_properties():
The server properties.
"""
con = get_connection()
body = con._http_request(method="GET", path="_server_properties").response
try:
body = con._http_request(method="GET", path="_server_properties").response
except EntityDoesNotExistError:
raise ServerConfigurationException("Debug mode in server is probably disabled.") from None
xml = etree.parse(body)
props = dict()
......
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2020 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2020 Timm Fitschen <t.fitschen@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
import copy
from lxml import etree
......
......@@ -60,6 +60,13 @@ class ConfigurationException(CaosDBException):
".pycaosdb.ini. Do at least one of them exist and are they correct?")
class ServerConfigurationException(CaosDBException):
"""The server is configured in a different way than expected.
This can be for example unexpected flags or settings or missing extensions.
"""
class ClientErrorException(CaosDBException):
def __init__(self, msg, status, body):
self.status = status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment