Skip to content

Commit

Permalink
add available languages information to the @site endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Dec 7, 2023
1 parent d5b83a6 commit ede2c50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/plone/restapi/services/site/get.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from plone.i18n.interfaces import ILanguageSchema
from plone.registry.interfaces import IRegistry
from plone.restapi.interfaces import IExpandableElement
from plone.restapi.services import Service
Expand Down Expand Up @@ -32,12 +33,17 @@ def __call__(self, expand=False):
image_settings = registry.forInterface(
IImagingSchema, prefix="plone", check=False
)
language_settings = registry.forInterface(
ILanguageSchema, prefix="plone", check=False
)
result["site"].update(
{
"plone.site_title": portal_state.portal_title(),
"plone.site_logo": site_settings.site_logo and getSiteLogo() or None,
"plone.robots_txt": site_settings.robots_txt,
"plone.allowed_sizes": image_settings.allowed_sizes,
"plone.default_language": language_settings.default_language,
"plone.available_languages": language_settings.available_languages,
}
)

Expand Down
3 changes: 2 additions & 1 deletion src/plone/restapi/tests/test_services_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class TestServicesSite(unittest.TestCase):

layer = PLONE_RESTAPI_DX_FUNCTIONAL_TESTING

def setUp(self):
Expand All @@ -36,3 +35,5 @@ def test_get_site(self):
self.assertIn("plone.site_logo", response.json())
self.assertIn("plone.robots_txt", response.json())
self.assertIn("plone.allowed_sizes", response.json())
self.assertIn("plone.available_languages", response.json())
self.assertIn("plone.default_language", response.json())

0 comments on commit ede2c50

Please sign in to comment.