diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2c07333 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11 diff --git a/src/collective/feedback/__init__.py b/src/collective/feedback/__init__.py index b661503..43b0762 100644 --- a/src/collective/feedback/__init__.py +++ b/src/collective/feedback/__init__.py @@ -2,5 +2,4 @@ """Init and utils.""" from zope.i18nmessageid import MessageFactory - _ = MessageFactory("collective.feedback") diff --git a/src/collective/feedback/locales/update.py b/src/collective/feedback/locales/update.py index ce89f54..9e6a067 100644 --- a/src/collective/feedback/locales/update.py +++ b/src/collective/feedback/locales/update.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import os -import pkg_resources import subprocess +import pkg_resources domain = "collective.feedback" os.chdir(pkg_resources.resource_filename(domain, "")) diff --git a/src/collective/feedback/restapi/services/add.py b/src/collective/feedback/restapi/services/add.py index 77e418c..2b8151e 100644 --- a/src/collective/feedback/restapi/services/add.py +++ b/src/collective/feedback/restapi/services/add.py @@ -1,4 +1,3 @@ -from collective.feedback.interfaces import ICollectiveFeedbackStore from plone import api from plone.protect.interfaces import IDisableCSRFProtection from plone.restapi.deserializer import json_body @@ -7,6 +6,8 @@ from zope.component import getUtility from zope.interface import alsoProvides +from collective.feedback.interfaces import ICollectiveFeedbackStore + class FeedbackAdd(Service): """ diff --git a/src/collective/feedback/restapi/services/delete.py b/src/collective/feedback/restapi/services/delete.py index 36fd8ff..9afed5f 100644 --- a/src/collective/feedback/restapi/services/delete.py +++ b/src/collective/feedback/restapi/services/delete.py @@ -1,12 +1,12 @@ -from collective.feedback.interfaces import ICollectiveFeedbackStore from plone.protect.interfaces import IDisableCSRFProtection from plone.restapi.services import Service from zExceptions import BadRequest from zope.component import getUtility -from zope.interface import alsoProvides -from zope.interface import implementer +from zope.interface import alsoProvides, implementer from zope.publisher.interfaces import IPublishTraverse +from collective.feedback.interfaces import ICollectiveFeedbackStore + @implementer(IPublishTraverse) class FeedbackDelete(Service): diff --git a/src/collective/feedback/restapi/services/get.py b/src/collective/feedback/restapi/services/get.py index b0db8f1..a32b16f 100644 --- a/src/collective/feedback/restapi/services/get.py +++ b/src/collective/feedback/restapi/services/get.py @@ -1,7 +1,8 @@ -from AccessControl import Unauthorized -from collective.feedback.interfaces import ICollectiveFeedbackStore +import csv from copy import deepcopy from datetime import datetime + +from AccessControl import Unauthorized from plone import api from plone.restapi.batching import HypermediaBatch from plone.restapi.search.utils import unflatten_dotted_dict @@ -12,7 +13,7 @@ from zope.interface import implementer from zope.publisher.interfaces import IPublishTraverse -import csv +from collective.feedback.interfaces import ICollectiveFeedbackStore @implementer(IPublishTraverse) diff --git a/src/collective/feedback/restapi/services/update.py b/src/collective/feedback/restapi/services/update.py index d55ea7c..ca4bcfc 100644 --- a/src/collective/feedback/restapi/services/update.py +++ b/src/collective/feedback/restapi/services/update.py @@ -1,4 +1,3 @@ -from collective.feedback.interfaces import ICollectiveFeedbackStore from plone import api from plone.protect.interfaces import IDisableCSRFProtection from plone.restapi.deserializer import json_body @@ -8,6 +7,8 @@ from zope.interface import alsoProvides, implementer from zope.publisher.interfaces import IPublishTraverse +from collective.feedback.interfaces import ICollectiveFeedbackStore + @implementer(IPublishTraverse) class FeedbackUpdate(Service): diff --git a/src/collective/feedback/storage/catalog.py b/src/collective/feedback/storage/catalog.py index e2f6b9a..4266051 100644 --- a/src/collective/feedback/storage/catalog.py +++ b/src/collective/feedback/storage/catalog.py @@ -3,8 +3,7 @@ from repoze.catalog.indexes.field import CatalogFieldIndex from repoze.catalog.indexes.text import CatalogTextIndex from souper.interfaces import ICatalogFactory -from souper.soup import NodeAttributeIndexer -from souper.soup import NodeTextIndexer +from souper.soup import NodeAttributeIndexer, NodeTextIndexer from zope.interface import implementer diff --git a/src/collective/feedback/storage/store.py b/src/collective/feedback/storage/store.py index c701c90..b795ea4 100644 --- a/src/collective/feedback/storage/store.py +++ b/src/collective/feedback/storage/store.py @@ -1,18 +1,14 @@ # -*- coding: utf-8 -*- -from collective.feedback.interfaces import ICollectiveFeedbackStore +import logging from datetime import datetime -from plone import api -from repoze.catalog.query import And -from repoze.catalog.query import Any -from repoze.catalog.query import Contains -from repoze.catalog.query import Eq -from souper.soup import get_soup -from souper.soup import Record -from zope.interface import implementer -import logging import six +from plone import api +from repoze.catalog.query import And, Any, Contains, Eq +from souper.soup import Record, get_soup +from zope.interface import implementer +from collective.feedback.interfaces import ICollectiveFeedbackStore logger = logging.getLogger(__name__) diff --git a/src/collective/feedback/testing.py b/src/collective/feedback/testing.py index a04d653..df70938 100644 --- a/src/collective/feedback/testing.py +++ b/src/collective/feedback/testing.py @@ -1,16 +1,17 @@ -from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE -from plone.app.testing import applyProfile -from plone.app.testing import FunctionalTesting -from plone.app.testing import IntegrationTesting -from plone.app.testing import PloneSandboxLayer -from plone.testing.zope import WSGI_SERVER_FIXTURE - -import collective.feedback import collective.honeypot import collective.honeypot.config import plone.restapi import souper.plone +from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE +from plone.app.testing import ( + FunctionalTesting, + IntegrationTesting, + PloneSandboxLayer, + applyProfile, +) +from plone.testing.zope import WSGI_SERVER_FIXTURE +import collective.feedback collective.honeypot.config.EXTRA_PROTECTED_ACTIONS = set(["feedback-add"]) collective.honeypot.config.HONEYPOT_FIELD = "honey" diff --git a/src/collective/feedback/tests/test_delete_content.py b/src/collective/feedback/tests/test_delete_content.py index a17a00c..d41169e 100644 --- a/src/collective/feedback/tests/test_delete_content.py +++ b/src/collective/feedback/tests/test_delete_content.py @@ -1,19 +1,21 @@ # -*- coding: utf-8 -*- -from collective.feedback.interfaces import ICollectiveFeedbackStore -from collective.feedback.testing import RESTAPI_TESTING +import unittest from datetime import datetime + +import transaction from plone import api -from plone.app.testing import setRoles -from plone.app.testing import SITE_OWNER_NAME -from plone.app.testing import SITE_OWNER_PASSWORD -from plone.app.testing import TEST_USER_ID +from plone.app.testing import ( + SITE_OWNER_NAME, + SITE_OWNER_PASSWORD, + TEST_USER_ID, + setRoles, +) from plone.restapi.testing import RelativeSession -from souper.soup import get_soup -from souper.soup import Record +from souper.soup import Record, get_soup from zope.component import getUtility -import transaction -import unittest +from collective.feedback.interfaces import ICollectiveFeedbackStore +from collective.feedback.testing import RESTAPI_TESTING class TestCustomerSatisfactionGet(unittest.TestCase): diff --git a/src/collective/feedback/tests/test_feedbacks_add.py b/src/collective/feedback/tests/test_feedbacks_add.py index 5d20231..08f9b3c 100644 --- a/src/collective/feedback/tests/test_feedbacks_add.py +++ b/src/collective/feedback/tests/test_feedbacks_add.py @@ -1,16 +1,19 @@ # -*- coding: utf-8 -*- -from collective.feedback.interfaces import ICollectiveFeedbackStore -from collective.feedback.testing import RESTAPI_TESTING +import unittest + +import transaction from plone import api -from plone.app.testing import setRoles -from plone.app.testing import SITE_OWNER_NAME -from plone.app.testing import SITE_OWNER_PASSWORD -from plone.app.testing import TEST_USER_ID +from plone.app.testing import ( + SITE_OWNER_NAME, + SITE_OWNER_PASSWORD, + TEST_USER_ID, + setRoles, +) from plone.restapi.testing import RelativeSession from zope.component import getUtility -import transaction -import unittest +from collective.feedback.interfaces import ICollectiveFeedbackStore +from collective.feedback.testing import RESTAPI_TESTING class TestAdd(unittest.TestCase): diff --git a/src/collective/feedback/tests/test_feedbacks_get.py b/src/collective/feedback/tests/test_feedbacks_get.py index 6f413e0..b505567 100644 --- a/src/collective/feedback/tests/test_feedbacks_get.py +++ b/src/collective/feedback/tests/test_feedbacks_get.py @@ -1,20 +1,22 @@ # -*- coding: utf-8 -*- -from collective.feedback.interfaces import ICollectiveFeedbackStore -from collective.feedback.testing import RESTAPI_TESTING +import unittest from datetime import datetime + +import transaction from plone import api -from plone.app.testing import setRoles -from plone.app.testing import SITE_OWNER_NAME -from plone.app.testing import SITE_OWNER_PASSWORD -from plone.app.testing import TEST_USER_ID +from plone.app.testing import ( + SITE_OWNER_NAME, + SITE_OWNER_PASSWORD, + TEST_USER_ID, + setRoles, +) from plone.restapi.serializer.converters import json_compatible from plone.restapi.testing import RelativeSession -from souper.soup import get_soup -from souper.soup import Record +from souper.soup import Record, get_soup from zope.component import getUtility -import transaction -import unittest +from collective.feedback.interfaces import ICollectiveFeedbackStore +from collective.feedback.testing import RESTAPI_TESTING class TestGet(unittest.TestCase): diff --git a/src/collective/feedback/tests/test_store.py b/src/collective/feedback/tests/test_store.py index 1ffaffa..3a09aa1 100644 --- a/src/collective/feedback/tests/test_store.py +++ b/src/collective/feedback/tests/test_store.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from collective.feedback.interfaces import ICollectiveFeedbackStore -from collective.feedback.testing import FUNCTIONAL_TESTING -from plone.app.testing import setRoles -from plone.app.testing import TEST_USER_ID -from zope.component import getUtility +import unittest import transaction -import unittest +from plone.app.testing import TEST_USER_ID, setRoles +from zope.component import getUtility + +from collective.feedback.interfaces import ICollectiveFeedbackStore +from collective.feedback.testing import FUNCTIONAL_TESTING class TestTool(unittest.TestCase): diff --git a/src/collective/feedback/upgrades.py b/src/collective/feedback/upgrades.py index 0f42610..f06ae53 100644 --- a/src/collective/feedback/upgrades.py +++ b/src/collective/feedback/upgrades.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- -from plone import api -from plone.app.upgrade.utils import installOrReinstallProduct - import logging +from plone import api +from plone.app.upgrade.utils import installOrReinstallProduct logger = logging.getLogger(__name__)