diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..5b3c112c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,56 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# +# EditorConfig Configuration file, for more details see: +# http://EditorConfig.org +# EditorConfig is a convention description, that could be interpreted +# by multiple editors to enforce common coding conventions for specific +# file types + +# top-most EditorConfig file: +# Will ignore other EditorConfig files in Home directory or upper tree level. +root = true + + +[*] +# Default settings for all files. +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +# Set default charset +charset = utf-8 +# Indent style default +indent_style = space +# Max Line Length - a hard line wrap, should be disabled +max_line_length = off + +[*.{py,cfg,ini}] +# 4 space indentation +indent_size = 4 + +[*.{yml,zpt,pt,dtml,zcml,html,xml}] +# 2 space indentation +indent_size = 2 + +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}] +# Frontend development +# 2 space indentation +indent_size = 2 +max_line_length = 80 + +[{Makefile,.gitmodules}] +# Tab indentation (no size specified, but view as 4 spaces) +indent_style = tab +indent_size = unset +tab_width = unset + + +## +# Add extra configuration options in .meta.toml: +# [editorconfig] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..38918f42 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[flake8] +doctests = 1 +ignore = + # black takes care of line length + E501, + # black takes care of where to break lines + W503, + # black takes care of spaces within slicing (list[:]) + E203, + # black takes care of spaces after commas + E231, + +## +# Add extra configuration options in .meta.toml: +# [flake8] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml new file mode 100644 index 00000000..c9848bcb --- /dev/null +++ b/.github/workflows/meta.yml @@ -0,0 +1,75 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +name: Meta +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + workflow_dispatch: + +## +# To set environment variables for all jobs, add in .meta.toml: +# [github] +# env = """ +# debug: 1 +# image-name: 'org/image' +# image-tag: 'latest' +# """ +## + +jobs: + qa: + uses: plone/meta/.github/workflows/qa.yml@main + test: + uses: plone/meta/.github/workflows/test.yml@main + coverage: + uses: plone/meta/.github/workflows/coverage.yml@main + dependencies: + uses: plone/meta/.github/workflows/dependencies.yml@main + release_ready: + uses: plone/meta/.github/workflows/release_ready.yml@main + circular: + uses: plone/meta/.github/workflows/circular.yml@main + +## +# To modify the list of default jobs being created add in .meta.toml: +# [github] +# jobs = [ +# "qa", +# "test", +# "coverage", +# "dependencies", +# "release_ready", +# "circular", +# ] +## + +## +# To request that some OS level dependencies get installed +# when running tests/coverage jobs, add in .meta.toml: +# [github] +# os_dependencies = "git libxml2 libxslt" +## + +## +# To test against a specific matrix of python versions +# when running tests jobs, add in .meta.toml: +# [github] +# py_versions = "['3.12', '3.11']" +## + + +## +# Specify additional jobs in .meta.toml: +# [github] +# extra_lines = """ +# another: +# uses: org/repo/.github/workflows/file.yml@main +# """ +## diff --git a/.gitignore b/.gitignore index d021691b..486392f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,41 +1,56 @@ -*.egg +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# python related *.egg-info +*.pyc +*.pyo + +# translation related *.mo -*.py[co] -*.mp4 + +# tools related +build/ .coverage -.installed.cfg -.DS_Store +.*project +coverage.xml +dist/ +docs/_build +__pycache__/ +.tox .vscode/ -.installed.txt -.mr.developer.cfg -.python-version -local.cfg -bin -build -develop-eggs -dist -downloads -eggs -htmlcov/ -instance/ -local.cfg -parts -var node_modules/ -npm-debug.log -.idea -include/ -lib/ -share/ -.idea + +# venv / buildout related +bin/ +develop-eggs/ +eggs/ +.eggs/ +etc/ +.installed.cfg include/ lib/ -share/ -pip-selfcheck.json -pyvenv.cfg lib64 -.make-sentinels/ -*-mxdev.txt -/venv -/.vscode/settings.json +.mr.developer.cfg +parts/ +pyvenv.cfg +var/ +local.cfg + +# mxdev +/instance/ +/.make-sentinels/ +/*-mxdev.txt +/reports/ +/sources/ +/venv/ +.installed.txt + + +## +# Add extra configuration options in .meta.toml: +# [gitignore] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.meta.toml b/.meta.toml new file mode 100644 index 00000000..467cf68a --- /dev/null +++ b/.meta.toml @@ -0,0 +1,9 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[meta] +template = "default" +commit-id = "721299ce" + +[pyproject] +codespell_skip = "*.js,*.min.js,*.min.js.map,*.min.css.map,*.svg,*.lock,*.json" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..d60054bd --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,94 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +ci: + autofix_prs: false + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.2 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black +- repo: https://github.com/collective/zpretty + rev: 3.1.0 + hooks: + - id: zpretty + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# zpretty_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/PyCQA/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# flake8_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# codespell_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest +- repo: https://github.com/regebro/pyroma + rev: "4.2" + hooks: + - id: pyroma +- repo: https://github.com/mgedmin/check-python-versions + rev: "0.22.0" + hooks: + - id: check-python-versions + args: ['--only', 'setup.py,pyproject.toml'] +- repo: https://github.com/collective/i18ndude + rev: "6.2.0" + hooks: + - id: i18ndude + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# i18ndude_extra_lines = """ +# _your own configuration lines_ +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/CHANGES.rst b/CHANGES.rst index 0df18101..738d5d24 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -36,7 +36,7 @@ Changes removed since python 3.10. Importing `collections.abc.Iterable` now. [petschki] -- Add mising `fetch_vocabulary` record for IQueryField +- Add missing `fetch_vocabulary` record for IQueryField This was introduced in plone.app.querystring 1.5.0 [laulaz] @@ -68,7 +68,7 @@ Changes - Fix taxonomy data edition when using Gunicorn WSGI (#123) [laulaz] - Implemented possibility to change the IDs. [Petchesi-Iulian] (#113) -- Added contraints to not allow duplicate IDs. [Petchesi-Iulian] (#113) +- Added constraints to not allow duplicate IDs. [Petchesi-Iulian] (#113) - Improved the editing interface. [Petchesi-Iulian] (#113) - Updated the documentation and tutorial. [Petchesi-Iulian] (#113) @@ -126,7 +126,7 @@ Changes 2.0.0 (2019-11-25) ------------------ -- add uninstall handler to cleanup persistent utilites and generated behaviors +- add uninstall handler to cleanup persistent utilities and generated behaviors [petschki] - Fix GenericSetup import/export in python3 @@ -138,7 +138,7 @@ Changes - Make generated behaviors language independent [agitator] -- export selected taxonomies as ZIPed folder with XML files +- export selected taxonomies as zipped folder with XML files [petschki] - Python 3 compatibility @@ -334,7 +334,7 @@ Changes Bugfix release -- Fixed problem with registration of search citeria in collections, the previous +- Fixed problem with registration of search criteria in collections, the previous registration broke export feature of plone.app.registry. Upgrade step has been added so please upgrade. [bosim] diff --git a/Makefile b/Makefile index 434e9884..df61ec9f 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ TEST_PREREQUISITES=${INSTALL_TARGET} RUN_PREREQUISITES=${INSTANCE_TARGET} ############################################################################## -# CONVINIENCE +# CONVENIENCE # install and run .PHONY: all # full install, test and run @@ -72,7 +72,7 @@ help: ## This help message @echo @echo "${WARN_COLOR}Additional parameters:${NO_COLOR}" @echo "${MARK_COLOR}PYTHON${NO_COLOR}: Python interpreter to be used (default: python3)" - @echo "${MARK_COLOR}VENV${NO_COLOR}: [on|off] wether to create a Python virtual environment or not (default: on)"s + @echo "${MARK_COLOR}VENV${NO_COLOR}: [on|off] whether to create a Python virtual environment or not (default: on)"s @echo "${MARK_COLOR}VENV_FOLDER${NO_COLOR}: location of the virtual environment (default: ./venv)" @echo @echo "${WARN_COLOR}Targets:${NO_COLOR}" @@ -155,7 +155,7 @@ ${MXDEV_SENTINEL}: ${PIP_SENTINEL} @touch ${MXDEV_SENTINEL} .PHONY: prepare -prepare: ${PREPARE_TARGET} ## prepare soures and dependencies +prepare: ${PREPARE_TARGET} ## prepare sources and dependencies ${PREPARE_PREREQUISITES}: @touch $@ diff --git a/dependabot.yml b/dependabot.yml new file mode 100644 index 00000000..bbd3ab05 --- /dev/null +++ b/dependabot.yml @@ -0,0 +1,11 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/docs/tutorial.md b/docs/tutorial.md index ecee23b7..efbc55e6 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -214,5 +214,5 @@ Click in the button "Save Changes": In the [Portfolio Folder](http://localhost:8080/Plone/portfolio), enable the view: ![Add portfolio view 003](./img/add-portfolio-view-003.png "add-portfolio-view-003") -The result is somethig like this: +The result is something like this: ![Add portfolio view 004](./img/add-portfolio-view-004.png "add-portfolio-view-004") diff --git a/mx.ini b/mx.ini index fd24c7b3..898eaa8b 100644 --- a/mx.ini +++ b/mx.ini @@ -2,7 +2,7 @@ # This is a mxdev configuration file # # available options are documented at -# https://pypi.org/proejct/mxdev/ +# https://pypi.org/project/mxdev/ # # read also README_MAKE.md in this folder # @@ -16,7 +16,7 @@ ignores = wheel collective.taxonomy -version-overrides = +version-overrides = setuptools==69.5.1 default-install-mode = direct diff --git a/pyproject.toml b/pyproject.toml index 2102d697..59cb5316 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,130 @@ -[tool.black] -line-length = 88 +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[build-system] +requires = ["setuptools>=68.2"] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# towncrier_extra_lines = """ +# extra_configuration +# """ +## [tool.isort] -profile = "black" -force_alphabetical_sort = "True" -force_single_line = "True" -lines_after_imports = "2" +profile = "plone" + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# isort_extra_lines = """ +# extra_configuration +# """ +## + +[tool.black] +target-version = ["py38"] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# black_extra_lines = """ +# extra_configuration +# """ +## + +[tool.codespell] +ignore-words-list = "discreet," +skip = "*.po,*.js,*.min.js,*.min.js.map,*.min.css.map,*.svg,*.lock,*.json" +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# codespell_ignores = "foo,bar" +# codespell_skip = "*.po,*.map,package-lock.json" +## + +[tool.dependencychecker] +Zope = [ + # Zope own provided namespaces + 'App', 'OFS', 'Products.Five', 'Products.OFSP', 'Products.PageTemplates', + 'Products.SiteAccess', 'Shared', 'Testing', 'ZPublisher', 'ZTUtils', + 'Zope2', 'webdav', 'zmi', + # ExtensionClass own provided namespaces + 'ExtensionClass', 'ComputedAttribute', 'MethodObject', + # Zope dependencies + 'AccessControl', 'Acquisition', 'AuthEncoding', 'beautifulsoup4', 'BTrees', + 'cffi', 'Chameleon', 'DateTime', 'DocumentTemplate', + 'MultiMapping', 'multipart', 'PasteDeploy', 'Persistence', 'persistent', + 'pycparser', 'python-gettext', 'pytz', 'RestrictedPython', 'roman', + 'soupsieve', 'transaction', 'waitress', 'WebOb', 'WebTest', 'WSGIProxy2', + 'z3c.pt', 'zc.lockfile', 'ZConfig', 'zExceptions', 'ZODB', 'zodbpickle', + 'zope.annotation', 'zope.browser', 'zope.browsermenu', 'zope.browserpage', + 'zope.browserresource', 'zope.cachedescriptors', 'zope.component', + 'zope.configuration', 'zope.container', 'zope.contentprovider', + 'zope.contenttype', 'zope.datetime', 'zope.deferredimport', + 'zope.deprecation', 'zope.dottedname', 'zope.event', 'zope.exceptions', + 'zope.filerepresentation', 'zope.globalrequest', 'zope.hookable', + 'zope.i18n', 'zope.i18nmessageid', 'zope.interface', 'zope.lifecycleevent', + 'zope.location', 'zope.pagetemplate', 'zope.processlifetime', 'zope.proxy', + 'zope.ptresource', 'zope.publisher', 'zope.schema', 'zope.security', + 'zope.sequencesort', 'zope.site', 'zope.size', 'zope.structuredtext', + 'zope.tal', 'zope.tales', 'zope.testbrowser', 'zope.testing', + 'zope.traversing', 'zope.viewlet' +] +'Products.CMFCore' = [ + 'docutils', 'five.localsitemanager', 'Missing', 'Products.BTreeFolder2', + 'Products.GenericSetup', 'Products.MailHost', 'Products.PythonScripts', + 'Products.StandardCacheManagers', 'Products.ZCatalog', 'Record', + 'zope.sendmail', 'Zope' +] +'plone.base' = [ + 'plone.batching', 'plone.registry', 'plone.schema','plone.z3cform', + 'Products.CMFCore', 'Products.CMFDynamicViewFTI', +] +python-dateutil = ['dateutil'] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# dependencies_ignores = "['zestreleaser.towncrier']" +# dependencies_mappings = [ +# "gitpython = ['git']", +# "pygithub = ['github']", +# ] +## + +[tool.check-manifest] +ignore = [ + ".editorconfig", + ".flake8", + ".meta.toml", + ".pre-commit-config.yaml", + "dependabot.yml", + "mx.ini", + "tox.ini", + +] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# check_manifest_ignores = """ +# "*.map.js", +# "*.pyc", +# """ +# check_manifest_extra_lines = """ +# ignore-bad-ideas = [ +# "some/test/file/PKG-INFO", +# ] +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/setup.cfg b/setup.cfg index e92c5414..e69de29b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,21 +0,0 @@ -[check-manifest] -ignore = - *.cfg - .coveragerc - .editorconfig - .gitattributes - -[isort] -# black compatible isort rules: -profile = black - -[flake8] -# black compatible flake8 rules: -ignore = W503, C812, E501, T001, C813, E203 -# E203, E266 -exclude = bootstrap.py,docs,*.egg.,omelette -max-line-length = 88 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 - -builtins = unicode,basestring diff --git a/setup.py b/setup.py index 4e2a2d8e..c25372ec 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ -import os - from setuptools import find_packages from setuptools import setup +import os + + version = "3.2.dev0" @@ -27,6 +28,7 @@ def read(*pathnames): "Environment :: Web Environment", "Framework :: Plone", "Framework :: Plone :: 6.0", + "Framework :: Plone :: 6.1", "Framework :: Plone :: Addon", "Framework :: Zope", "Framework :: Zope :: 5", @@ -67,7 +69,7 @@ def read(*pathnames): "plone.app.contenttypes", "plone.app.querystring", "plone.app.robotframework[debug]", - "plone.restapi" + "plone.restapi", ], }, entry_points=""" diff --git a/src/collective/taxonomy/behavior.py b/src/collective/taxonomy/behavior.py index 85aabd0e..4838ecd1 100644 --- a/src/collective/taxonomy/behavior.py +++ b/src/collective/taxonomy/behavior.py @@ -161,9 +161,7 @@ def addMetadata(self): try: catalog.addColumn(self.field_name) except CatalogError: - logging.info( - "Column {} already exists".format(self.field_name) - ) # noqa: E501 + logging.info(f"Column {self.field_name} already exists") # noqa: E501 def unregisterInterface(self): if hasattr(generated, self.short_name): diff --git a/src/collective/taxonomy/collectionfilter.py b/src/collective/taxonomy/collectionfilter.py index 55120a72..f7e60f0d 100644 --- a/src/collective/taxonomy/collectionfilter.py +++ b/src/collective/taxonomy/collectionfilter.py @@ -1,8 +1,5 @@ from collective.collectionfilter.interfaces import IGroupByCriteria from collective.collectionfilter.interfaces import IGroupByModifier -from collective.taxonomy import PATH_SEPARATOR -from collective.taxonomy import PRETTY_PATH_SEPARATOR -from collective.taxonomy import utility from collective.taxonomy.interfaces import ITaxonomy from plone import api from plone.behavior.interfaces import IBehavior @@ -41,7 +38,7 @@ def groupby_modifier(groupby): behavior = sm.queryUtility(IBehavior, name=taxonomy[1].getGeneratedName()) taxonomy_field_prefix = behavior.field_prefix taxonomy_shortname = taxonomy[1].getShortName() - taxonomy_index_name = "{}{}".format(taxonomy_field_prefix, taxonomy_shortname) + taxonomy_index_name = f"{taxonomy_field_prefix}{taxonomy_shortname}" groupby._groupby[taxonomy_index_name] = { "index": taxonomy_index_name, "metadata": taxonomy_index_name, diff --git a/src/collective/taxonomy/controlpanel.py b/src/collective/taxonomy/controlpanel.py index 2aa4bc39..e2b07613 100644 --- a/src/collective/taxonomy/controlpanel.py +++ b/src/collective/taxonomy/controlpanel.py @@ -217,7 +217,7 @@ def handleAdd(self, action): def handleCancel(self, action): api.portal.show_message(_("Add cancelled"), request=self.request) self.request.response.redirect( - "{}/@@taxonomy-settings".format(self.context.absolute_url()) + f"{self.context.absolute_url()}/@@taxonomy-settings" ) @@ -255,14 +255,14 @@ def handleApply(self, action): api.portal.show_message(_("Changes saved"), request=self.request) self.request.response.redirect( - "{}/@@taxonomy-settings".format(self.context.absolute_url()) + f"{self.context.absolute_url()}/@@taxonomy-settings" ) @button.buttonAndHandler(_("Cancel"), name="cancel") def handleCancel(self, action): api.portal.show_message(_("Edit cancelled"), request=self.request) self.request.response.redirect( - "{}/@@taxonomy-settings".format(self.context.absolute_url()) + f"{self.context.absolute_url()}/@@taxonomy-settings" ) diff --git a/src/collective/taxonomy/edit_taxonomy_data.pt b/src/collective/taxonomy/edit_taxonomy_data.pt index 216bb4b1..095e9d0c 100644 --- a/src/collective/taxonomy/edit_taxonomy_data.pt +++ b/src/collective/taxonomy/edit_taxonomy_data.pt @@ -1,34 +1,56 @@ - -
-