Skip to content

Commit

Permalink
Revert "blacked"
Browse files Browse the repository at this point in the history
This reverts commit 6e049d5.
  • Loading branch information
cekk committed Nov 8, 2023
1 parent 6e049d5 commit 02f38dc
Show file tree
Hide file tree
Showing 25 changed files with 170 additions and 158 deletions.
3 changes: 2 additions & 1 deletion src/rer/solrpush/adapters/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def maxfilesize(self):
return max_size * 1024 * 1024

def get_file_to_index(self):
""" """
"""
"""
file_obj = getattr(self.context, "file", None)
if not file_obj:
return None
Expand Down
1 change: 1 addition & 0 deletions src/rer/solrpush/adapters/rss_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@implementer(IFeedItem)
@adapter(ISolrBrain, IFeed)
class SOLRFeedItem(BaseItem):

@property
def link(self):
return self.context.getURL()
Expand Down
10 changes: 5 additions & 5 deletions src/rer/solrpush/behaviors/solr_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ class ISolrFields(model.Schema):
required=False,
default=True,
missing_value=True,
title=_("label_showinsearch", default="Show in search"),
title=_("label_showinsearch", default=u"Show in search"),
description=_("help_showinsearch", default=""),
)

searchwords = schema.List(
required=False,
default=[],
missing_value=[],
title=_("label_searchwords", default="Search words"),
title=_("label_searchwords", default=u"Search words"),
value_type=schema.TextLine(),
description=_(
"help_searchwords",
"Specify words for which this item will show up "
"as the first search result. Multiple words can be "
"specified on new lines.",
u"Specify words for which this item will show up "
u"as the first search result. Multiple words can be "
u"specified on new lines.",
),
)

Expand Down
16 changes: 8 additions & 8 deletions src/rer/solrpush/browser/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@


class FormDefault(group.Group):
label = _("settings_default_label", default="Settings")
label = _("settings_default_label", default=u"Settings")
fields = field.Fields(IRerSolrpushConf)


class FormSearch(group.Group):
label = _("settings_search_label", default="Search")
label = _("settings_search_label", default=u"Search")
description = _(
"settings_search_help",
default="Use these settings to tweak search results.",
default=u"Use these settings to tweak search results.",
)
fields = field.Fields(IRerSolrpushSearchConf)

Expand All @@ -39,11 +39,11 @@ class RerSolrpushEditForm(RegistryEditForm):

schema = IRerSolrpushSettings
groups = (FormDefault, FormSearch)
label = _("Solr Push Configuration")
label = _(u"Solr Push Configuration")

formErrorsMessage = _(
"settings_form_error",
default="Sono presenti degli errori, si prega di ricontrollare i dati inseriti",
default=u"Sono presenti degli errori, si prega di ricontrollare i dati inseriti",
)

def updateFields(self):
Expand All @@ -59,15 +59,15 @@ def handleSave(self, action):
self.status = self.formErrorsMessage
return
self.applyChanges(data)
api.portal.show_message(_("Changes saved."), request=self.request)
api.portal.show_message(_(u"Changes saved."), request=self.request)
init_error = init_solr_push()
if init_error:
api.portal.show_message(
init_error, type="error", request=self.request
)
else:
api.portal.show_message(
_("Loaded schema.xml from SOLR"), request=self.request
_(u"Loaded schema.xml from SOLR"), request=self.request
)
self.request.response.redirect(self.request.getURL())

Expand All @@ -86,7 +86,7 @@ def handleReload(self, action):
)
else:
api.portal.show_message(
_("Reloaded schema.xml from SOLR"), request=self.request
_(u"Reloaded schema.xml from SOLR"), request=self.request
)
self.request.response.redirect(self.request.getURL())

Expand Down
6 changes: 4 additions & 2 deletions src/rer/solrpush/browser/elevate_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@


class ElevateSettingsEditForm(RegistryEditForm):

schema = IElevateSettings
label = _(
"solr_elevate_configuration_label",
default="Solr Push Elevate Configuration",
default=u"Solr Push Elevate Configuration",
)

fields = field.Fields(IElevateSettings)
fields["elevate_schema"].widgetFactory = JSONFieldWidget

def updateWidgets(self):
""" """
"""
"""
super(ElevateSettingsEditForm, self).updateWidgets()
self.widgets["elevate_schema"].schema = IElevateRowSchema

Expand Down
17 changes: 10 additions & 7 deletions src/rer/solrpush/browser/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@


def timer(func=time):
"""set up a generator returning the elapsed time since the last call"""
""" set up a generator returning the elapsed time since the last call """

def gen(last=func()):
while True:
Expand All @@ -57,19 +57,20 @@ def gen(last=func()):


class SolrMaintenanceBaseForm(form.Form):

# template = ViewPageTemplateFile('templates/reindex_solr.pt')

ignoreContext = True

@button.buttonAndHandler(_("start_label", default="Start"))
@button.buttonAndHandler(_("start_label", default=u"Start"))
def handleApply(self, action):
data, errors = self.extractData()
if errors:
self.status = self.formErrorsMessage
return
self.do_action()

@button.buttonAndHandler(_("cancel_label", default="Cancel"))
@button.buttonAndHandler(_("cancel_label", default=u"Cancel"))
def handleCancel(self, action):
msg_label = _("maintenance_cancel_action", default="Action cancelled")
api.portal.show_message(message=msg_label, request=self.request)
Expand Down Expand Up @@ -107,8 +108,8 @@ def solr_error_message(self):
return translate(
_(
"solr_error_connection",
default="There have been problems connecting to SOLR. "
"Contact site administrator.",
default=u"There have been problems connecting to SOLR. "
u"Contact site administrator.",
),
context=self.request,
)
Expand Down Expand Up @@ -364,7 +365,7 @@ def sync_contents(
class DoReindexView(ReindexBaseView):
def __call__(self):
authenticator = getMultiAdapter(
(self.context, self.request), name="authenticator"
(self.context, self.request), name=u"authenticator"
)
if not authenticator.verify():
raise Unauthorized
Expand All @@ -386,7 +387,7 @@ class DoSyncView(ReindexBaseView):
def __call__(self, cron_view=False):
if not cron_view:
authenticator = getMultiAdapter(
(self.context, self.request), name="authenticator"
(self.context, self.request), name=u"authenticator"
)
if not authenticator.verify():
raise Unauthorized
Expand Down Expand Up @@ -456,6 +457,7 @@ def is_active(self):


class ReindexSolrView(ReactView):

label = _("maintenance_reindex_label", default="Reindex SOLR")
description = _(
"maintenance_reindex_help",
Expand All @@ -465,6 +467,7 @@ class ReindexSolrView(ReactView):


class SyncSolrView(ReactView):

label = _("maintenance_sync_label", default="Sync SOLR")
description = _(
"maintenance_sync_help",
Expand Down
2 changes: 1 addition & 1 deletion src/rer/solrpush/browser/querybuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def clean_query_for_solr(self, query):
portal_state = api.content.get_view(
context=self.context,
request=self.request,
name="plone_portal_state",
name=u"plone_portal_state",
)
root_path = portal_state.navigation_root_path()
path = self.extract_value(v)
Expand Down
6 changes: 3 additions & 3 deletions src/rer/solrpush/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def commit(self, wait=None):
logger.exception("error indexing %s %s", iop, uid)
message = _(
"content_indexed_error",
default="There was a problem indexing or unindexing "
"this content. Please take note of this address and "
"contact site administrator.",
default=u"There was a problem indexing or unindexing "
u"this content. Please take note of this address and "
u"contact site administrator.",
)
api.portal.show_message(
message=message, request=getRequest(), type="warning"
Expand Down
14 changes: 7 additions & 7 deletions src/rer/solrpush/interfaces/elevate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ def __contains__(self, value):

class IElevateRowSchema(model.Schema):
text = schema.List(
title=_("elevate_row_schema_text_label", default="Text"),
title=_("elevate_row_schema_text_label", default=u"Text"),
description=_(
"elevate_row_schema_text_help",
default="The word that should match in the search.",
default=u"The word that should match in the search.",
),
required=True,
value_type=schema.TextLine(),
)
uid = RelationList(
title=_("elevate_row_schema_uid_label", "Elements"),
title=_("elevate_row_schema_uid_label", u"Elements"),
description=_(
"elevate_row_schema_uid_help",
"Select a list of elements to elevate for that search word.",
u"Select a list of elements to elevate for that search word.",
),
value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"),
required=True,
Expand All @@ -54,10 +54,10 @@ class IElevateSettings(model.Schema):
""" """

elevate_schema = schema.SourceText(
title=_("elevate_schema_label", default="Elevate configuration"),
title=_(u"elevate_schema_label", default=u"Elevate configuration"),
description=_(
"elevate_schema_help",
default="Insert a list of values for elevate.",
u"elevate_schema_help",
default=u"Insert a list of values for elevate.",
),
required=False,
)
Expand Down
Loading

0 comments on commit 02f38dc

Please sign in to comment.