Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Apr 11, 2024
1 parent 1c51899 commit cc2f480
Show file tree
Hide file tree
Showing 38 changed files with 345 additions and 307 deletions.
13 changes: 1 addition & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,7 @@ ignore =
.gitattributes

[isort]
# black compatible isort rules:
force_alphabetical_sort = True
force_single_line = True
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses = True
lines_after_imports = 2
line_length = 88
not_skip =
__init__.py
skip =
profile = plone

[flake8]
# black compatible flake8 rules:
Expand Down
3 changes: 1 addition & 2 deletions src/collective/volto/formsupport/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
"""Init and utils."""
from zope.i18nmessageid import MessageFactory

import logging

from zope.i18nmessageid import MessageFactory

logger = logging.getLogger(__name__)
_ = MessageFactory("collective.volto.formsupport")
36 changes: 20 additions & 16 deletions src/collective/volto/formsupport/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,39 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="collective.volto.formsupport">
i18n_domain="collective.volto.formsupport"
>

<!-- Set overrides folder for Just-a-Bunch-Of-Templates product -->
<include package="z3c.jbot" file="meta.zcml" />
<include
package="z3c.jbot"
file="meta.zcml"
/>
<browser:jbot
directory="overrides"
layer="collective.volto.formsupport.interfaces.ICollectiveVoltoFormsupportLayer"
/>

<!-- Publish static files -->
<plone:static
directory="static"
name="collective.volto.formsupport"
type="plone"
directory="static"
/>

<browser:page
for="*"
name="send_mail_template"
template="send_mail_template.pt"
permission="zope2.View"
/>
<browser:page
for="*"
name="send_mail_template_table"
template="send_mail_template_table.pt"
permission="zope2.View"
/>
<browser:page
<browser:page
name="send_mail_template"
for="*"
template="send_mail_template.pt"
permission="zope2.View"
/>
<browser:page
name="send_mail_template_table"
for="*"
template="send_mail_template_table.pt"
permission="zope2.View"
/>
<browser:page
name="email-confirm-view"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
class=".email_confirm_view.EmailConfirmView"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from Products.Five.browser import BrowserView
from plone import api
from Products.Five.browser import BrowserView


class EmailConfirmView(BrowserView):
Expand Down
88 changes: 47 additions & 41 deletions src/collective/volto/formsupport/captcha/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml">
xmlns:zcml="http://namespaces.zope.org/zcml"
>

<adapter
zcml:condition="installed plone.formwidget.hcaptcha"
factory=".hcaptcha.HCaptchaSupport"
provides="..interfaces.ICaptchaSupport"
for="* zope.publisher.interfaces.browser.IBrowserRequest"
name="hcaptcha"
/>
<adapter
factory=".hcaptcha.HCaptchaSupport"
provides="..interfaces.ICaptchaSupport"
for="*
zope.publisher.interfaces.browser.IBrowserRequest"
name="hcaptcha"
zcml:condition="installed plone.formwidget.hcaptcha"
/>

<adapter
zcml:condition="installed plone.formwidget.hcaptcha"
factory=".hcaptcha.HCaptchaInvisibleSupport"
provides="..interfaces.ICaptchaSupport"
for="* zope.publisher.interfaces.browser.IBrowserRequest"
name="hcaptcha_invisible"
/>
<adapter
factory=".hcaptcha.HCaptchaInvisibleSupport"
provides="..interfaces.ICaptchaSupport"
for="*
zope.publisher.interfaces.browser.IBrowserRequest"
name="hcaptcha_invisible"
zcml:condition="installed plone.formwidget.hcaptcha"
/>

<adapter
zcml:condition="installed plone.formwidget.recaptcha"
factory=".recaptcha.RecaptchaSupport"
provides="..interfaces.ICaptchaSupport"
for="* zope.publisher.interfaces.browser.IBrowserRequest"
name="recaptcha"
/>
<adapter
factory=".recaptcha.RecaptchaSupport"
provides="..interfaces.ICaptchaSupport"
for="*
zope.publisher.interfaces.browser.IBrowserRequest"
name="recaptcha"
zcml:condition="installed plone.formwidget.recaptcha"
/>

<adapter
zcml:condition="installed collective.z3cform.norobots"
factory=".norobots.NoRobotsSupport"
provides="..interfaces.ICaptchaSupport"
for="* zope.publisher.interfaces.browser.IBrowserRequest"
name="norobots-captcha"
/>

<adapter
zcml:condition="installed collective.honeypot"
factory=".honeypot.HoneypotSupport"
provides="..interfaces.ICaptchaSupport"
for="* zope.publisher.interfaces.browser.IBrowserRequest"
name="honeypot"
/>
<adapter
factory=".norobots.NoRobotsSupport"
provides="..interfaces.ICaptchaSupport"
for="*
zope.publisher.interfaces.browser.IBrowserRequest"
name="norobots-captcha"
zcml:condition="installed collective.z3cform.norobots"
/>

<utility
name="collective.volto.formsupport.captcha.providers"
component=".vocabularies.captcha_providers_vocabulary_factory"
/>
<adapter
factory=".honeypot.HoneypotSupport"
provides="..interfaces.ICaptchaSupport"
for="*
zope.publisher.interfaces.browser.IBrowserRequest"
name="honeypot"
zcml:condition="installed collective.honeypot"
/>

<utility
name="collective.volto.formsupport.captcha.providers"
component=".vocabularies.captcha_providers_vocabulary_factory"
/>

</configure>
6 changes: 4 additions & 2 deletions src/collective/volto/formsupport/captcha/hcaptcha.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from . import CaptchaSupport
from collective.volto.formsupport import _
from plone.formwidget.hcaptcha.interfaces import IHCaptchaSettings
from plone.formwidget.hcaptcha.nohcaptcha import submit

Expand All @@ -9,6 +7,10 @@
from zope.component import queryUtility
from zope.i18n import translate

from collective.volto.formsupport import _

from . import CaptchaSupport


class HCaptchaSupport(CaptchaSupport):
name = _("HCaptcha")
Expand Down
6 changes: 4 additions & 2 deletions src/collective/volto/formsupport/captcha/honeypot.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from . import CaptchaSupport
from collective.honeypot.config import HONEYPOT_FIELD
from collective.honeypot.utils import found_honeypot
from collective.volto.formsupport import _
from plone.restapi.deserializer import json_body
from zExceptions import BadRequest
from zope.i18n import translate

from collective.volto.formsupport import _

from . import CaptchaSupport


class HoneypotSupport(CaptchaSupport):
name = _("Honeypot Support")
Expand Down
12 changes: 6 additions & 6 deletions src/collective/volto/formsupport/captcha/norobots.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from . import CaptchaSupport
from collective.volto.formsupport import _
from collective.z3cform.norobots.browser.interfaces import (
INorobotsWidgetSettings,
)
import json

from collective.z3cform.norobots.browser.interfaces import INorobotsWidgetSettings
from plone import api
from plone.registry.interfaces import IRegistry
from zExceptions import BadRequest
from zope.component import queryUtility
from zope.i18n import translate

import json
from collective.volto.formsupport import _

from . import CaptchaSupport


class NoRobotsSupport(CaptchaSupport):
Expand Down
6 changes: 4 additions & 2 deletions src/collective/volto/formsupport/captcha/recaptcha.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from . import CaptchaSupport
from collective.volto.formsupport import _
from plone.formwidget.recaptcha.interfaces import IReCaptchaSettings
from plone.formwidget.recaptcha.norecaptcha import submit
from plone.registry.interfaces import IRegistry
from zExceptions import BadRequest
from zope.component import queryUtility
from zope.i18n import translate

from collective.volto.formsupport import _

from . import CaptchaSupport


class RecaptchaSupport(CaptchaSupport):
name = _("Google ReCaptcha")
Expand Down
6 changes: 3 additions & 3 deletions src/collective/volto/formsupport/captcha/vocabularies.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ..interfaces import ICaptchaSupport
from zope.component import getAdapters
from zope.interface import provider
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary

from ..interfaces import ICaptchaSupport


@provider(IVocabularyFactory)
Expand Down
7 changes: 4 additions & 3 deletions src/collective/volto/formsupport/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="collective.volto.formsupport">
i18n_domain="collective.volto.formsupport"
>

<i18n:registerTranslations directory="locales" />

Expand All @@ -26,18 +27,18 @@
<genericsetup:registerProfile
name="default"
title="Volto: Form support"
directory="profiles/default"
description="Installs the collective.volto.formsupport add-on."
provides="Products.GenericSetup.interfaces.EXTENSION"
directory="profiles/default"
post_handler=".setuphandlers.post_install"
/>

<genericsetup:registerProfile
name="uninstall"
title="Volto: Form support (uninstall)"
directory="profiles/uninstall"
description="Uninstalls the collective.volto.formsupport add-on."
provides="Products.GenericSetup.interfaces.EXTENSION"
directory="profiles/uninstall"
post_handler=".setuphandlers.uninstall"
/>

Expand Down
15 changes: 7 additions & 8 deletions src/collective/volto/formsupport/datamanager/catalog.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# -*- coding: utf-8 -*-

from collective.volto.formsupport import logger
from collective.volto.formsupport.interfaces import IFormDataStore
from collective.volto.formsupport.utils import get_blocks
from copy import deepcopy
from datetime import datetime

from plone.dexterity.interfaces import IDexterityContent
from plone.restapi.deserializer import json_body
from repoze.catalog.catalog import Catalog
from repoze.catalog.indexes.field import CatalogFieldIndex
from souper.interfaces import ICatalogFactory
from souper.soup import get_soup
from souper.soup import NodeAttributeIndexer
from souper.soup import Record
from souper.soup import NodeAttributeIndexer, Record, get_soup
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import Interface, implementer

from collective.volto.formsupport import logger
from collective.volto.formsupport.interfaces import IFormDataStore
from collective.volto.formsupport.utils import get_blocks


@implementer(ICatalogFactory)
Expand Down
25 changes: 13 additions & 12 deletions src/collective/volto/formsupport/datamanager/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="collective.volto.formsupport">
i18n_domain="collective.volto.formsupport"
>

<!-- Enable each Dexterity content to be a soup root -->
<class class="plone.dexterity.content.DexterityContent">
<implements interface="souper.plone.interfaces.ISoupRoot" />
</class>
<!-- Enable each Dexterity content to be a soup root -->
<class class="plone.dexterity.content.DexterityContent">
<implements interface="souper.plone.interfaces.ISoupRoot" />
</class>

<!-- register the catalog -->
<utility
provides="souper.interfaces.ICatalogFactory"
factory=".catalog.FormDataSoupCatalogFactory"
name="form_data"
/>
<!-- register the catalog -->
<utility
factory=".catalog.FormDataSoupCatalogFactory"
provides="souper.interfaces.ICatalogFactory"
name="form_data"
/>

<adapter factory=".catalog.FormDataStore" />
<adapter factory=".catalog.FormDataStore" />
</configure>
2 changes: 1 addition & 1 deletion src/collective/volto/formsupport/locales/update.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

import os
import pkg_resources
import subprocess

import pkg_resources

domain = "collective.volto.formsupport"
os.chdir(pkg_resources.resource_filename(domain, ""))
Expand Down
9 changes: 5 additions & 4 deletions src/collective/volto/formsupport/permissions.zcml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone">
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone"
>

<configure zcml:condition="installed AccessControl.security">
<!-- -*- extra stuff goes here -*- -->
<!-- -*- extra stuff goes here -*- -->


</configure>
Expand Down
Loading

0 comments on commit cc2f480

Please sign in to comment.