Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Mar 22, 2024
1 parent f810ff6 commit f58067f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
9 changes: 5 additions & 4 deletions src/redturtle/volto/monkeypatch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# -*- coding: utf-8 -*-
import datetime
import os

from Acquisition import aq_base
from plone.app.caching import purge
from plone.app.event.base import dt_start_of_day
from plone.app.event.dx.behaviors import IEventBasic
from plone.app.event.recurrence import Occurrence
from plone.app.multilingual.interfaces import IPloneAppMultilingualInstalled
from plone.event.interfaces import IEventAccessor, IRecurrenceSupport
from plone.event.interfaces import IEventAccessor
from plone.event.interfaces import IRecurrenceSupport
from plone.event.recurrence import recurrence_sequence_ical

# from plone.event.utils import pydt
from Products.CMFPlone.interfaces import IConstrainTypes
from zope.globalrequest import getRequest

import datetime
import os


def occurrences(self, range_start=None, range_end=None):
"""Return all occurrences of an event, possibly within a start and end
Expand Down
12 changes: 6 additions & 6 deletions src/redturtle/volto/monkeypatch/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:monkey="http://namespaces.plone.org/monkey"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="redturtle.volto"
>

<include package="collective.monkeypatcher" />

<monkey:patch
<monkey:patch
original="occurrences"
replacement=".occurrences"
class="plone.app.event.recurrence.RecurrenceSupport"
Expand Down Expand Up @@ -66,20 +66,20 @@
/>

<monkey:patch
description="Custom search"
class="plone.restapi.search.handler.SearchHandler"
original="search"
replacement=".ploneRestapiSearchHandler.search"
class="plone.restapi.search.handler.SearchHandler"
docstringWarning="Monkeypatched search method of the plone.restapi.search.handler.SearchHandler"
description="Custom search"
preserveOriginal="true"
/>

<monkey:patch
description="Custom _parse_query"
class="plone.restapi.search.handler.SearchHandler"
original="_parse_query"
replacement=".ploneRestapiSearchHandler._parse_query"
class="plone.restapi.search.handler.SearchHandler"
docstringWarning="Monkeypatched _parse_quesry method of the plone.restapi.search.handler.SearchHandler"
description="Custom _parse_query"
preserveOriginal="true"
/>

Expand Down
11 changes: 7 additions & 4 deletions src/redturtle/volto/monkeypatch/ploneRestapiSearchHandler.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# -*- coding: utf-8 -*-
from plone import api
from plone.restapi.interfaces import ISerializeToJson
from plone.restapi.search.handler import SearchHandler as OriginalHandler
from plone.restapi.search.utils import unflatten_dotted_dict
from zope.component import getMultiAdapter

from redturtle.volto import logger
from redturtle.volto.config import MAX_LIMIT
from redturtle.volto.interfaces import IRedTurtleVoltoSettings
from zope.component import getMultiAdapter


# search for 'ranking' in 'SearchableText' and rank very high
# when the term is in 'Subject' and high when it is in 'Title'.
# print the id and the normalized rank
try:
from Products.AdvancedQuery import And, Eq, In, Or, RankByQueries_Sum
from Products.AdvancedQuery import And
from Products.AdvancedQuery import Eq
from Products.AdvancedQuery import In
from Products.AdvancedQuery import Or
from Products.AdvancedQuery import RankByQueries_Sum

HAS_ADVANCEDQUERY = True
except ImportError:
Expand Down

0 comments on commit f58067f

Please sign in to comment.