Skip to content

Commit bb85621

Browse files
author
Piotr Slupski
committed
Implement getconfigsettings admin endpoint
1 parent e57878a commit bb85621

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

filecloudapi/datastructures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def _set_entries(self, response: Element):
328328
if elem.tag != "setting":
329329
continue
330330

331-
self.entries[elem.get("param")] = elem.get("value")
331+
self.entries[list(elem)[0].text] = list(elem)[1].text
332332

333333

334334
@dataclass

filecloudapi/fcserver.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import xml.etree.ElementTree as ET
99
from io import SEEK_CUR, SEEK_END, SEEK_SET, BufferedReader, BytesIO
1010
from pathlib import Path
11-
from typing import Dict, Optional, Union
11+
from typing import Dict, Optional, Union, List
1212
from urllib.parse import urlencode
1313

1414
import requests
@@ -1661,7 +1661,7 @@ def admin_resetpolicyforuser(self, username: str) -> None:
16611661

16621662
self._raise_exception_from_command(resp)
16631663

1664-
def get_config_settings(self, config: list[str]) -> None:
1664+
def admin_get_config_settings(self, config: List[str]) -> ServerSettings:
16651665
"""
16661666
Retrieve Filecloud configuration settings. The config list should
16671667
contain FC configuration keys.
@@ -1673,18 +1673,14 @@ def get_config_settings(self, config: list[str]) -> None:
16731673
except (ValueError, TypeError):
16741674
count = 0
16751675

1676-
config_opts = []
1676+
config_opts = {}
16771677
for i in range(count):
16781678
param_key = f"param{i}"
1679-
config_opts[param_key] = config[i]
1679+
config_opts[param_key] = config[i] # type:ignore
16801680

1681-
resp = self._api_call(
1682-
"/admin/getconfigsetting",
1683-
{
1684-
"count": str(len(config_opts)),
1685-
**{f"param{i}": value for i, value in enumerate(config_opts)},
1686-
},
1687-
)
1681+
config_opts["count"] = str(len(config_opts))
1682+
1683+
resp = self._api_call("/admin/getconfigsetting", config_opts)
16881684

16891685
settings = ServerSettings(resp)
16901686
return settings

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22

33
name = "filecloudapi-python"
4-
version = "0.4.1"
4+
version = "0.4.2"
55
description = "A Python library to connect to a Filecloud server"
66

77
packages = [{ include = "filecloudapi" }]

0 commit comments

Comments
 (0)