Skip to content

Commit

Permalink
feat: add a new cacheRuleset to use with our custom directory rest en…
Browse files Browse the repository at this point in the history
…dpoints

WEB-4153
  • Loading branch information
remdub committed Jan 7, 2025
1 parent 8ff644d commit 2270dc6
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
1.2.17 (unreleased)
-------------------

- Nothing changed yet.
- WEB-4153 : Add a new cacheRuleset to use with our custom rest endpoints
[remdub]


1.2.16 (2024-08-05)
Expand Down
12 changes: 11 additions & 1 deletion src/imio/directory/core/rest/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone">
xmlns:cache="http://namespaces.zope.org/cache"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.zope.org/zcml">

<include package=".search" />

<plone:service
name="@odwb"
Expand All @@ -22,4 +26,10 @@
layer="imio.directory.core.interfaces.IImioDirectoryCoreLayer"
/>

<cache:rulesetType
name="imio.directory.core.rest"
title="imio.directory.core rest endpoints"
description="rest endpoints overriden by imio.directory.core"
/>

</configure>
Empty file.
25 changes: 25 additions & 0 deletions src/imio/directory/core/rest/search/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:cache="http://namespaces.zope.org/cache"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="imio.smartweb">

<plone:service
name="@search"
method="GET"
accept="application/json"
for="*"
factory=".endpoint.SearchGet"
permission="zope2.View"
layer="imio.directory.core.interfaces.IImioDirectoryCoreLayer"
/>

<cache:ruleset
for=".endpoint.SearchGet"
ruleset="imio.directory.core.rest"
zcml:condition="have plone-app-caching-3"
/>

</configure>
8 changes: 8 additions & 0 deletions src/imio/directory/core/rest/search/endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-

from plone.restapi.services.search.get import SearchGet as BaseSearchGet


class SearchGet(BaseSearchGet):
def reply(self):
return super(SearchGet, self).reply()

0 comments on commit 2270dc6

Please sign in to comment.