From c4c2127f4fdad3831dc323637b6dbed4021bc51f Mon Sep 17 00:00:00 2001 From: Fred van Dijk Date: Wed, 15 May 2024 19:07:07 +0200 Subject: [PATCH] Create a separte backend for plain volto restore the create_site.py in this backend from before we added the plone.distribution support/setup Update GHA to build a separate backend Add separate network for plain volto backend<>frontend communication --- .github/workflows/build_deploy.yml | 83 +++++ .github/workflows/ci.yml | 4 + backend-volto/.dockerignore | 12 + backend-volto/.gitattributes | 1 + backend-volto/.gitignore | 44 +++ backend-volto/Dockerfile | 29 ++ backend-volto/Makefile | 175 +++++++++ backend-volto/constraints.txt | 1 + backend-volto/instance.yaml | 7 + backend-volto/mx.ini | 16 + backend-volto/pyproject.toml | 42 +++ backend-volto/requirements-docker.txt | 2 + backend-volto/requirements.txt | 8 + backend-volto/scripts/create_site.py | 62 ++++ backend-volto/scripts/default.json | 8 + backend-volto/src/plone6demo/CHANGES.md | 6 + backend-volto/src/plone6demo/CONTRIBUTORS.md | 3 + backend-volto/src/plone6demo/LICENSE.GPL | 339 ++++++++++++++++++ backend-volto/src/plone6demo/LICENSE.md | 15 + backend-volto/src/plone6demo/MANIFEST.in | 6 + backend-volto/src/plone6demo/README.md | 36 ++ backend-volto/src/plone6demo/setup.cfg | 6 + backend-volto/src/plone6demo/setup.py | 73 ++++ .../src/plone6demo/src/plone6demo/__init__.py | 9 + .../src/plone6demo/behaviors/__init__.py | 0 .../src/plone6demo/behaviors/configure.zcml | 6 + .../src/plone6demo/browser/__init__.py | 0 .../src/plone6demo/browser/configure.zcml | 15 + .../src/plone6demo/browser/static/.gitkeep | 0 .../plone6demo/src/plone6demo/configure.zcml | 32 ++ .../src/plone6demo/content/__init__.py | 0 .../src/plone6demo/dependencies.zcml | 7 + .../src/plone6demo/indexers/__init__.py | 0 .../src/plone6demo/indexers/configure.zcml | 10 + .../plone6demo/src/plone6demo/interfaces.py | 7 + .../src/plone6demo/locales/__init__.py | 0 .../en/LC_MESSAGES/plone_6_demo_site.po | 15 + .../src/plone6demo/locales/plone6demo.pot | 54 +++ .../plone6demo/locales/plone_6_demo_site.pot | 18 + .../pt_BR/LC_MESSAGES/plone_6_demo_site.po | 15 + .../src/plone6demo/locales/update.py | 78 ++++ .../src/plone6demo/permissions.zcml | 12 + .../plone6demo/src/plone6demo/profiles.zcml | 25 ++ .../plone6demo/profiles/default/actions.xml | 45 +++ .../profiles/default/browserlayer.xml | 6 + .../plone6demo/profiles/default/catalog.xml | 13 + .../plone6demo/profiles/default/metadata.xml | 7 + ...se.interfaces.controlpanel.IMailSchema.xml | 9 + ...se.interfaces.controlpanel.ISiteSchema.xml | 9 + .../plone.i18n.interfaces.ILanguageSchema.xml | 12 + .../src/plone6demo/profiles/default/theme.xml | 5 + .../src/plone6demo/profiles/default/types.xml | 10 + .../profiles/default/types/.gitkeep | 0 .../profiles/uninstall/browserlayer.xml | 6 + .../src/plone6demo/serializers/__init__.py | 0 .../src/plone6demo/serializers/configure.zcml | 3 + .../src/plone6demo/services/__init__.py | 0 .../src/plone6demo/services/configure.zcml | 3 + .../src/plone6demo/setuphandlers/__init__.py | 11 + .../src/plone6demo/subscribers/__init__.py | 0 .../src/plone6demo/subscribers/configure.zcml | 3 + .../src/plone6demo/src/plone6demo/testing.py | 52 +++ .../src/plone6demo/tests/__init__.py | 0 .../src/plone6demo/tests/test_setup.py | 62 ++++ .../plone6demo/tests/test_upgrades.py_tmpl | 40 +++ .../src/plone6demo/upgrades/__init__.py | 0 .../src/plone6demo/upgrades/configure.zcml | 19 + .../src/plone6demo/vocabularies/__init__.py | 21 ++ .../plone6demo/vocabularies/configure.zcml | 10 + devops/stacks/demo.plone.org.yml | 9 +- 70 files changed, 1632 insertions(+), 4 deletions(-) create mode 100644 backend-volto/.dockerignore create mode 100644 backend-volto/.gitattributes create mode 100644 backend-volto/.gitignore create mode 100644 backend-volto/Dockerfile create mode 100644 backend-volto/Makefile create mode 100644 backend-volto/constraints.txt create mode 100644 backend-volto/instance.yaml create mode 100644 backend-volto/mx.ini create mode 100644 backend-volto/pyproject.toml create mode 100644 backend-volto/requirements-docker.txt create mode 100644 backend-volto/requirements.txt create mode 100644 backend-volto/scripts/create_site.py create mode 100644 backend-volto/scripts/default.json create mode 100644 backend-volto/src/plone6demo/CHANGES.md create mode 100644 backend-volto/src/plone6demo/CONTRIBUTORS.md create mode 100644 backend-volto/src/plone6demo/LICENSE.GPL create mode 100644 backend-volto/src/plone6demo/LICENSE.md create mode 100644 backend-volto/src/plone6demo/MANIFEST.in create mode 100644 backend-volto/src/plone6demo/README.md create mode 100644 backend-volto/src/plone6demo/setup.cfg create mode 100644 backend-volto/src/plone6demo/setup.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/behaviors/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/behaviors/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/browser/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/browser/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/browser/static/.gitkeep create mode 100644 backend-volto/src/plone6demo/src/plone6demo/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/content/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/dependencies.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/indexers/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/indexers/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/interfaces.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/locales/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/locales/en/LC_MESSAGES/plone_6_demo_site.po create mode 100644 backend-volto/src/plone6demo/src/plone6demo/locales/plone6demo.pot create mode 100644 backend-volto/src/plone6demo/src/plone6demo/locales/plone_6_demo_site.pot create mode 100644 backend-volto/src/plone6demo/src/plone6demo/locales/pt_BR/LC_MESSAGES/plone_6_demo_site.po create mode 100644 backend-volto/src/plone6demo/src/plone6demo/locales/update.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/permissions.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/actions.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/browserlayer.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/catalog.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/metadata.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/theme.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/types.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/default/types/.gitkeep create mode 100644 backend-volto/src/plone6demo/src/plone6demo/profiles/uninstall/browserlayer.xml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/serializers/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/serializers/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/services/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/services/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/setuphandlers/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/subscribers/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/subscribers/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/testing.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/tests/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/tests/test_setup.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/tests/test_upgrades.py_tmpl create mode 100644 backend-volto/src/plone6demo/src/plone6demo/upgrades/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/upgrades/configure.zcml create mode 100644 backend-volto/src/plone6demo/src/plone6demo/vocabularies/__init__.py create mode 100644 backend-volto/src/plone6demo/src/plone6demo/vocabularies/configure.zcml diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index 46c745e..bbac7bb 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -91,6 +91,86 @@ jobs: run: | PYTHONWARNINGS=ignore zope-testrunner --auto-color --auto-progress --test-path src/plone_6_demo_site/src/ + backend-volto-black: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend-volto' + check: 'black' + + backend-volto-flake8: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend-volto' + check: 'flake8' + + backend-volto-isort: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend-volto' + check: 'isort' + + backend-volto-zpretty: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + + - name: Run check + uses: plone/code-analysis-action@v2 + with: + base_dir: 'backend-volto' + check: 'zpretty' + + backend-volto-tests: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ./backend-volto + + steps: + - uses: actions/checkout@v4 + + - name: Setup Plone ${{ env.plone }} with Python ${{ env.python }} + uses: plone/setup-plone@v2.0.0 + with: + python-version: ${{ env.python }} + plone-version: ${{ env.plone }} + + - name: Install package + run: | + pip install mxdev + mxdev -c mx.ini + pip install -r requirements-mxdev.txt + + - name: Run tests + run: | + PYTHONWARNINGS=ignore zope-testrunner --auto-color --auto-progress --test-path src/plone_6_demo_site/src/ + + classic-black: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest @@ -339,6 +419,9 @@ jobs: - image: backend context: backend file: Dockerfile + - image: backend-volto + context: backend-volto + file: Dockerfile - image: frontend context: frontend file: Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11c1ee7..757f95d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,10 +6,14 @@ on: paths: - "backend/**" - "frontend/**" + - "frontend-volto/**" + - ".github/workflows/ci.yml" pull_request: paths: - "backend/**" + - "backend-volto/**" + - "frontend/**" - ".github/workflows/ci.yml" diff --git a/backend-volto/.dockerignore b/backend-volto/.dockerignore new file mode 100644 index 0000000..91cbf57 --- /dev/null +++ b/backend-volto/.dockerignore @@ -0,0 +1,12 @@ +.editorconfig +.gitattributes +bin +Dockerfile +include +instance +instance.yaml +lib +lib64 +Makefile +pyvenv.cfg +var \ No newline at end of file diff --git a/backend-volto/.gitattributes b/backend-volto/.gitattributes new file mode 100644 index 0000000..b07d5f4 --- /dev/null +++ b/backend-volto/.gitattributes @@ -0,0 +1 @@ +CHANGES.md merge=union \ No newline at end of file diff --git a/backend-volto/.gitignore b/backend-volto/.gitignore new file mode 100644 index 0000000..dec570b --- /dev/null +++ b/backend-volto/.gitignore @@ -0,0 +1,44 @@ +.coverage +*.egg-info +*.log +*.mo +*.py? +*.swp +# dirs +bin/ +buildout-cache/ +data/*.json +develop-eggs/ +eggs/ +etc/ +htmlcov/ +include/ +instance/ +lib/ +lib64/ +local/ +node_modules/ +parts/ +src/plone6demo/setuphandlers/data/*.json +dist/* +test.plone_addon/ +var/ +# files +.installed.cfg +.mr.developer.cfg +lib64 +log.html +output.xml +pip-selfcheck.json +report.html +.vscode/ +.tox/ +reports/ +venv/ +*-mxdev.txt +# excludes +live.cfg +inituser +pip-wheel-metadata +pyvenv.cfg +instance-local.yaml \ No newline at end of file diff --git a/backend-volto/Dockerfile b/backend-volto/Dockerfile new file mode 100644 index 0000000..c3a16ef --- /dev/null +++ b/backend-volto/Dockerfile @@ -0,0 +1,29 @@ +# syntax=docker/dockerfile:1 +ARG SEED=1000 +ARG PLONE_VERSION=6.0.11 +FROM plone/plone-backend:${PLONE_VERSION} + + +LABEL maintainer="Plone Foundation " \ + org.label-schema.name="demo-backend-volto" \ + org.label-schema.description="Plone 6 Demo Plain Volto Site backend image." \ + org.label-schema.vendor="Plone Foundation" + +# Add local code +COPY . . + +# Install local requirements and fix permissions +RUN <= tuple(map(int, '$(PYTHON_VERSION_MIN)'.split('.'))))") +ifeq ($(PYTHON_VERSION_OK),False) + $(error "Need python $(PYTHON_VERSION) >= $(PYTHON_VERSION_MIN)") +endif + + +# Add the following 'help' target to your Makefile +# And add help text after each target name starting with '\#\#' +.PHONY: help +help: ## This help message + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: clean +clean: clean-build clean-pyc clean-test clean-venv clean-instance ## remove all build, test, coverage and Python artifacts + +.PHONY: clean-instance +clean-instance: ## remove existing instance + rm -fr instance etc inituser var + +.PHONY: clean-venv +clean-venv: ## remove virtual environment + rm -fr bin include lib lib64 + +.PHONY: clean-build +clean-build: ## remove build artifacts + rm -fr build/ + rm -fr dist/ + rm -fr .eggs/ + find . -name '*.egg-info' -exec rm -fr {} + + find . -name '*.egg' -exec rm -rf {} + + +.PHONY: clean-pyc +clean-pyc: ## remove Python file artifacts + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '*~' -exec rm -f {} + + find . -name '__pycache__' -exec rm -fr {} + + +.PHONY: clean-test +clean-test: ## remove test and coverage artifacts + rm -f .coverage + rm -fr htmlcov/ + +bin/pip: + @echo "$(GREEN)==> Setup Virtual Env$(RESET)" + $(PYTHON) -m venv . + bin/pip install -U "setuptools" "pip" "wheel" "cookiecutter" "mxdev" + +.PHONY: config +config: bin/pip ## Create instance configuration + @echo "$(GREEN)==> Create instance configuration$(RESET)" + if [[ -s instance-override.yaml ]]; then \ + echo " Using instance-local.yaml"; \ + bin/cookiecutter -f --no-input --config-file instance-local.yaml gh:plone/cookiecutter-zope-instance ;\ + else \ + bin/cookiecutter -f --no-input --config-file instance.yaml gh:plone/cookiecutter-zope-instance ;\ + fi + +# i18n +bin/i18ndude: bin/pip + @echo "$(GREEN)==> Install translation tools$(RESET)" + bin/pip install i18ndude + +.PHONY: i18n +i18n: bin/i18ndude ## Update locales + @echo "$(GREEN)==> Updating locales$(RESET)" + bin/update_locale + +# TODO `make build` +# build: + +.PHONY: build-dev +build-dev: config ## pip install Plone packages + @echo "$(GREEN)==> Setup Build$(RESET)" + bin/mxdev -c mx.ini + bin/pip install -r requirements-mxdev.txt + +.PHONY: format +format: ## Format the codebase according to our standards + @echo "$(GREEN)==> Format codebase$(RESET)" + $(FORMAT) + +.PHONY: lint +lint: lint-isort lint-black lint-flake8 lint-zpretty ## check code style + +.PHONY: lint-black +lint-black: ## validate black formating + $(LINT) black + +.PHONY: lint-flake8 +lint-flake8: ## validate black formating + $(LINT) flake8 + +.PHONY: lint-isort +lint-isort: ## validate using isort + $(LINT) isort + +.PHONY: lint-pyroma +lint-pyroma: ## validate using pyroma + $(LINT) pyroma + +.PHONY: lint-zpretty +lint-zpretty: ## validate ZCML/XML using zpretty + $(LINT) zpretty + +.PHONY: test +test: ## run tests + ./bin/zope-testrunner --auto-color --auto-progress --test-path src/plone6demo/src/ + +.PHONY: test_quiet +test_quiet: ## run tests removing deprecation warnings + PYTHONWARNINGS=ignore ./bin/zope-testrunner --auto-color --auto-progress --test-path src/plone6demo/src/ + +.PHONY: create-site +create-site: ## Create a new site using default distribution and default answers + DEVELOP_DISTRIBUTIONS=$(DISTRIBUTIONS) ALLOWED_DISTRIBUTIONS=$(DISTRIBUTIONS) PYTHONWARNINGS=ignore ./bin/zconsole run instance/etc/zope.conf scripts/create_site.py + +.PHONY: start +start: ## Start a Plone instance on localhost:8080 + PYTHONWARNINGS=ignore ./bin/runwsgi instance/etc/zope.ini + +.PHONY: debug +debug: instance/etc/zope.ini ## Run debug console + PYTHONWARNINGS=ignore ./bin/zconsole debug instance/etc/zope.conf + +.PHONY: build-image +build-image: ## Build Docker Image + @docker build . -t $(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile --build-arg PLONE_VERSION=$(PLONE_VERSION) diff --git a/backend-volto/constraints.txt b/backend-volto/constraints.txt new file mode 100644 index 0000000..d32a83f --- /dev/null +++ b/backend-volto/constraints.txt @@ -0,0 +1 @@ +-c https://dist.plone.org/release/6.0.11/constraints.txt diff --git a/backend-volto/instance.yaml b/backend-volto/instance.yaml new file mode 100644 index 0000000..f72b8e1 --- /dev/null +++ b/backend-volto/instance.yaml @@ -0,0 +1,7 @@ +default_context: + initial_user_name: 'admin' + initial_user_password: 'admin' + + zcml_package_includes: 'plone6demo' + + db_storage: direct diff --git a/backend-volto/mx.ini b/backend-volto/mx.ini new file mode 100644 index 0000000..b8d723d --- /dev/null +++ b/backend-volto/mx.ini @@ -0,0 +1,16 @@ +; This is a mxdev configuration file +; it can be used to override versions of packages already defined in the +; constraints files and to add new packages from VCS like git. +; to learn more about mxdev visit https://pypi.org/project/mxdev/ + +[settings] +; example how to override a package version +; version-overrides = +; plone.volto==4.0.2 + +; example section to use packages from git +; [example.contenttype] +; url = https://github.com/collective/example.contenttype.git +; pushurl = git@github.com:collective/example.contenttype.git +; extras = test +; branch = feature-7 diff --git a/backend-volto/pyproject.toml b/backend-volto/pyproject.toml new file mode 100644 index 0000000..b2af481 --- /dev/null +++ b/backend-volto/pyproject.toml @@ -0,0 +1,42 @@ +[tool.black] +line-length = 88 +target-version = ['py38'] +include = '\.pyi?$' +exclude = ''' +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + )/ +) +''' + +[tool.isort] +profile = "black" +force_alphabetical_sort = true +force_single_line = true +lines_after_imports = 2 +line_length = 120 + +[tool.flakeheaven] +format="grouped" +max_line_length=88 +show_source=true +max-complexity=25 + +[tool.flakeheaven.plugins] +pycodestyle = ["+*"] +pyflakes = ["+*"] +"flake8-*" = ["+*"] + +[tool.plone-code-analysis] +paths = "src/plone6demo/setup.py src/plone6demo/src/ scripts/" +paths_pyroma = "src/plone6demo" diff --git a/backend-volto/requirements-docker.txt b/backend-volto/requirements-docker.txt new file mode 100644 index 0000000..01a6b6c --- /dev/null +++ b/backend-volto/requirements-docker.txt @@ -0,0 +1,2 @@ +-c constraints.txt +src/plone6demo diff --git a/backend-volto/requirements.txt b/backend-volto/requirements.txt new file mode 100644 index 0000000..bd17242 --- /dev/null +++ b/backend-volto/requirements.txt @@ -0,0 +1,8 @@ +-c constraints.txt +-e src/plone6demo[test] + +zope.testrunner + +# Add required add-ons +# (Ideally add them in setup.py for plone6demo) +# collective.easyform diff --git a/backend-volto/scripts/create_site.py b/backend-volto/scripts/create_site.py new file mode 100644 index 0000000..a33b8e0 --- /dev/null +++ b/backend-volto/scripts/create_site.py @@ -0,0 +1,62 @@ +from AccessControl.SecurityManagement import newSecurityManager +from plone6demo.interfaces import IPLONE6DEMOLayer +from Products.CMFPlone.factory import _DEFAULT_PROFILE +from Products.CMFPlone.factory import addPloneSite +from Testing.makerequest import makerequest +from zope.interface import directlyProvidedBy +from zope.interface import directlyProvides + +import os +import transaction + + +truthy = frozenset(("t", "true", "y", "yes", "on", "1")) + + +def asbool(s): + """Return the boolean value ``True`` if the case-lowered value of string + input ``s`` is a :term:`truthy string`. If ``s`` is already one of the + boolean values ``True`` or ``False``, return it.""" + if s is None: + return False + if isinstance(s, bool): + return s + s = str(s).strip() + return s.lower() in truthy + + +DELETE_EXISTING = asbool(os.getenv("DELETE_EXISTING")) + +app = makerequest(app) # noQA + +request = app.REQUEST + +ifaces = [ + IPLONE6DEMOLayer, +] + list(directlyProvidedBy(request)) + +directlyProvides(request, *ifaces) + +admin = app.acl_users.getUserById("admin") +admin = admin.__of__(app.acl_users) +newSecurityManager(None, admin) + +site_id = "Plone" +payload = { + "title": "Plone 6 Demo Site", + "profile_id": _DEFAULT_PROFILE, + "extension_ids": ["plone6demo:default", "plone6demo:initial", "plone.volto:demo"], + "setup_content": False, + "default_language": "en", + "portal_timezone": "America/Sao_Paulo", +} + +if site_id in app.objectIds() and DELETE_EXISTING: + app.manage_delObjects([site_id]) + transaction.commit() + app._p_jar.sync() + +if site_id not in app.objectIds(): + site = addPloneSite(app, site_id, **payload) + transaction.commit() + app._p_jar.sync() \ No newline at end of file diff --git a/backend-volto/scripts/default.json b/backend-volto/scripts/default.json new file mode 100644 index 0000000..baf6d0a --- /dev/null +++ b/backend-volto/scripts/default.json @@ -0,0 +1,8 @@ +{ + "site_id": "Plone", + "title": "Welcome to Plone 6", + "description": "Site created with a new Plone Distribution", + "default_language": "en", + "portal_timezone": "Europe/Berlin", + "setup_content": true +} \ No newline at end of file diff --git a/backend-volto/src/plone6demo/CHANGES.md b/backend-volto/src/plone6demo/CHANGES.md new file mode 100644 index 0000000..658f5a9 --- /dev/null +++ b/backend-volto/src/plone6demo/CHANGES.md @@ -0,0 +1,6 @@ +# Changelog + + +## 1.0a1 (unreleased) + +- Initial version. [collective] diff --git a/backend-volto/src/plone6demo/CONTRIBUTORS.md b/backend-volto/src/plone6demo/CONTRIBUTORS.md new file mode 100644 index 0000000..89b26f2 --- /dev/null +++ b/backend-volto/src/plone6demo/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +# Contributors + +- collective [collective@plone.org] diff --git a/backend-volto/src/plone6demo/LICENSE.GPL b/backend-volto/src/plone6demo/LICENSE.GPL new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/backend-volto/src/plone6demo/LICENSE.GPL @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/backend-volto/src/plone6demo/LICENSE.md b/backend-volto/src/plone6demo/LICENSE.md new file mode 100644 index 0000000..37adf1e --- /dev/null +++ b/backend-volto/src/plone6demo/LICENSE.md @@ -0,0 +1,15 @@ +plone6demo Copyright 2022, Plone Foundatiuon + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, +MA 02111-1307 USA. diff --git a/backend-volto/src/plone6demo/MANIFEST.in b/backend-volto/src/plone6demo/MANIFEST.in new file mode 100644 index 0000000..7055134 --- /dev/null +++ b/backend-volto/src/plone6demo/MANIFEST.in @@ -0,0 +1,6 @@ +graft src/plone6demo +graft docs +include *.rst +include *.md +include *.cfg +global-exclude *.pyc diff --git a/backend-volto/src/plone6demo/README.md b/backend-volto/src/plone6demo/README.md new file mode 100644 index 0000000..a9fba29 --- /dev/null +++ b/backend-volto/src/plone6demo/README.md @@ -0,0 +1,36 @@ +# plone6demo + +A new project using Plone 6. + +## Features + +### Content Types + +- TBD + +### Initial content + +This package contains a simple volto configuration. + +Installation +------------ + +Install plone6demo with `pip`: + +```shell +pip install plone6demo +``` +And to create the Plone site: + +```shell +make create_site +``` + +## Contribute + +- [Issue Tracker](https://github.com/collective/plone-6-demo-site/issues) +- [Source Code](https://github.com/collective/plone-6-demo-site/) + +## License + +The project is licensed under the GPLv2. diff --git a/backend-volto/src/plone6demo/setup.cfg b/backend-volto/src/plone6demo/setup.cfg new file mode 100644 index 0000000..5324128 --- /dev/null +++ b/backend-volto/src/plone6demo/setup.cfg @@ -0,0 +1,6 @@ +[check-manifest] +ignore = + *.cfg + .coveragerc + .editorconfig + .gitattributes diff --git a/backend-volto/src/plone6demo/setup.py b/backend-volto/src/plone6demo/setup.py new file mode 100644 index 0000000..6cddfdf --- /dev/null +++ b/backend-volto/src/plone6demo/setup.py @@ -0,0 +1,73 @@ +"""Installer for the plone6demo package.""" + +from setuptools import find_packages +from setuptools import setup + + +long_description = "\n\n".join( + [ + open("README.md").read(), + open("CONTRIBUTORS.md").read(), + open("CHANGES.md").read(), + ] +) + + +setup( + name="plone6demo", + version="1.0.0a1", + description="Plone 6 Demo Site configuration package.", + long_description=long_description, + classifiers=[ + "Environment :: Web Environment", + "Framework :: Plone", + "Framework :: Plone :: Addon", + "Framework :: Plone :: 6.0", + "Framework :: Plone :: Distribution", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: OS Independent", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + ], + keywords="Python Plone CMS", + author="Plone Foundation", + author_email="collective@plone.org", + url="https://github.com/collective/plone-6-demo-site", + project_urls={ + "PyPI": "https://pypi.python.org/pypi/plone6demo", + "Source": "https://github.com/collective/plone-6-demo-site", + "Tracker": "https://github.com/collective/plone-6-demo-site/issues", + }, + license="GPL version 2", + packages=find_packages("src", exclude=["ez_setup"]), + package_dir={"": "src"}, + include_package_data=True, + zip_safe=False, + python_requires=">=3.8", + install_requires=[ + "setuptools", + "Plone", + "plone.api", + "plone.distribution>=1.0.0b4", + "collective.volto.formsupport", + ], + extras_require={ + "test": [ + "parameterized", + "zest.releaser[recommended]", + "plone.app.testing[robot]>=7.0.0a3", + "plone.restapi[test]", + "collective.MockMailHost", + ], + }, + entry_points=""" + [z3c.autoinclude.plugin] + target = plone + [console_scripts] + update_locale = plone6demo.locales.update:update_locale + """, +) diff --git a/backend-volto/src/plone6demo/src/plone6demo/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/__init__.py new file mode 100644 index 0000000..d86bf65 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/__init__.py @@ -0,0 +1,9 @@ +"""Init and utils.""" +from zope.i18nmessageid import MessageFactory + +import logging + + +_ = MessageFactory("plone6demo") + +logger = logging.getLogger("plone6demo") diff --git a/backend-volto/src/plone6demo/src/plone6demo/behaviors/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/behaviors/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/behaviors/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/behaviors/configure.zcml new file mode 100644 index 0000000..e6626aa --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/behaviors/configure.zcml @@ -0,0 +1,6 @@ + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/browser/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/browser/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/browser/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/browser/configure.zcml new file mode 100644 index 0000000..88f1639 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/browser/configure.zcml @@ -0,0 +1,15 @@ + + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/browser/static/.gitkeep b/backend-volto/src/plone6demo/src/plone6demo/browser/static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/configure.zcml new file mode 100644 index 0000000..a96a27e --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/configure.zcml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/content/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/content/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/dependencies.zcml b/backend-volto/src/plone6demo/src/plone6demo/dependencies.zcml new file mode 100644 index 0000000..3c111d6 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/dependencies.zcml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/indexers/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/indexers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/indexers/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/indexers/configure.zcml new file mode 100644 index 0000000..94ea6a1 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/indexers/configure.zcml @@ -0,0 +1,10 @@ + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/interfaces.py b/backend-volto/src/plone6demo/src/plone6demo/interfaces.py new file mode 100644 index 0000000..e7fc726 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/interfaces.py @@ -0,0 +1,7 @@ +"""Module where all interfaces, events and exceptions live.""" + +from zope.publisher.interfaces.browser import IDefaultBrowserLayer + + +class IPLONE6DEMOLayer(IDefaultBrowserLayer): + """Marker interface that defines a browser layer.""" diff --git a/backend-volto/src/plone6demo/src/plone6demo/locales/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/locales/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/locales/en/LC_MESSAGES/plone_6_demo_site.po b/backend-volto/src/plone6demo/src/plone6demo/locales/en/LC_MESSAGES/plone_6_demo_site.po new file mode 100644 index 0000000..0cadc3f --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/locales/en/LC_MESSAGES/plone_6_demo_site.po @@ -0,0 +1,15 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2022-05-25 17:12+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"Language-Code: en\n" +"Language-Name: English\n" +"Preferred-Encodings: utf-8 latin1\n" +"Domain: DOMAIN\n" diff --git a/backend-volto/src/plone6demo/src/plone6demo/locales/plone6demo.pot b/backend-volto/src/plone6demo/src/plone6demo/locales/plone6demo.pot new file mode 100644 index 0000000..21e5b06 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/locales/plone6demo.pot @@ -0,0 +1,54 @@ +#--- PLEASE EDIT THE LINES BELOW CORRECTLY --- +#SOME DESCRIPTIVE TITLE. +#FIRST AUTHOR , YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2022-12-12 21:31+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"Language-Code: en\n" +"Language-Name: English\n" +"Preferred-Encodings: utf-8 latin1\n" +"Domain: plone6demo\n" + +#: plone6demo/src/plone6demo/vocabularies/__init__.py:11 +msgid "Education" +msgstr "" + +#: plone6demo/src/plone6demo/vocabularies/__init__.py:9 +msgid "Government" +msgstr "" + +#: plone6demo/src/plone6demo/profiles.zcml:22 +msgid "Initial content for our website." +msgstr "" + +#: plone6demo/src/plone6demo/vocabularies/__init__.py:10 +msgid "NGO" +msgstr "" + +#: plone6demo/src/plone6demo/profiles.zcml:22 +msgid "Plone 6 Demo Site: Initial content" +msgstr "" + +#: plone6demo/src/plone6demo/profiles.zcml:13 +msgid "Plone 6 Demo Site: Install" +msgstr "" + +#: plone6demo/src/plone6demo/profiles.zcml:30 +msgid "Plone 6 Demo Site: Uninstall" +msgstr "" + +#: plone6demo/src/plone6demo/profiles.zcml:13 +msgid "Policy package to install our site" +msgstr "" + +#: plone6demo/src/plone6demo/profiles.zcml:30 +msgid "Uninstall Plone 6 Demo Site setup." +msgstr "" diff --git a/backend-volto/src/plone6demo/src/plone6demo/locales/plone_6_demo_site.pot b/backend-volto/src/plone6demo/src/plone6demo/locales/plone_6_demo_site.pot new file mode 100644 index 0000000..e8d9c0b --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/locales/plone_6_demo_site.pot @@ -0,0 +1,18 @@ +#--- PLEASE EDIT THE LINES BELOW CORRECTLY --- +#SOME DESCRIPTIVE TITLE. +#FIRST AUTHOR , YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2022-05-25 17:12+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"Language-Code: en\n" +"Language-Name: English\n" +"Preferred-Encodings: utf-8 latin1\n" +"Domain: plone6demo\n" diff --git a/backend-volto/src/plone6demo/src/plone6demo/locales/pt_BR/LC_MESSAGES/plone_6_demo_site.po b/backend-volto/src/plone6demo/src/plone6demo/locales/pt_BR/LC_MESSAGES/plone_6_demo_site.po new file mode 100644 index 0000000..5ae34e2 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/locales/pt_BR/LC_MESSAGES/plone_6_demo_site.po @@ -0,0 +1,15 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2022-05-25 17:12+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"Language-Code: pt_BR\n" +"Language-Name: Portugu&es do Brasil\n" +"Preferred-Encodings: utf-8 latin1\n" +"Domain: DOMAIN\n" diff --git a/backend-volto/src/plone6demo/src/plone6demo/locales/update.py b/backend-volto/src/plone6demo/src/plone6demo/locales/update.py new file mode 100644 index 0000000..a9c2e54 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/locales/update.py @@ -0,0 +1,78 @@ +"""Update locales.""" +from pathlib import Path + +import logging +import re +import subprocess + + +logger = logging.getLogger("i18n") +logger.setLevel(logging.DEBUG) + + +PATTERN = r"^[a-z]{2}.*" +domains = ("plone6demo",) +cwd = Path.cwd() +target_path = Path(__file__).parent.parent.resolve() +locale_path = target_path / "locales" + +i18ndude = cwd / "bin" / "i18ndude" +if not i18ndude.exists(): + i18ndude = cwd / "i18ndude" + +# ignore node_modules files resulting in errors +excludes = '"*.html *json-schema*.xml"' + + +def locale_folder_setup(domain: str): + languages = [path for path in locale_path.glob("*") if path.is_dir()] + for lang_folder in languages: + lc_messages_path = lang_folder / "LC_MESSAGES" + lang = lang_folder.name + if lc_messages_path.exists(): + continue + elif re.match(PATTERN, lang): + lc_messages_path.mkdir() + cmd = ( + f"msginit --locale={lang} " + f"--input={locale_path}/{domain}.pot " + f"--output={locale_path}/{lang}/LC_MESSAGES/{domain}.po" + ) + subprocess.call( + cmd, + shell=True, + ) + + +def _rebuild(domain: str): + cmd = ( + f"{i18ndude} rebuild-pot --pot {locale_path}/{domain}.pot " + f"--exclude {excludes} " + f"--create {domain} {target_path}" + ) + subprocess.call( + cmd, + shell=True, + ) + + +def _sync(domain: str): + cmd = ( + f"{i18ndude} sync --pot {locale_path}/{domain}.pot " + f"{locale_path}/*/LC_MESSAGES/{domain}.po" + ) + subprocess.call( + cmd, + shell=True, + ) + + +def update_locale(): + if i18ndude.exists(): + for domain in domains: + logger.info(f"Updating translations for {domain}") + locale_folder_setup(domain) + _rebuild(domain) + _sync(domain) + else: + logger.error("Not able to find i18ndude") diff --git a/backend-volto/src/plone6demo/src/plone6demo/permissions.zcml b/backend-volto/src/plone6demo/src/plone6demo/permissions.zcml new file mode 100644 index 0000000..2cfba2a --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/permissions.zcml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles.zcml b/backend-volto/src/plone6demo/src/plone6demo/profiles.zcml new file mode 100644 index 0000000..cf3a6b8 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles.zcml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/actions.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/actions.xml new file mode 100644 index 0000000..44a0283 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/actions.xml @@ -0,0 +1,45 @@ + + + + + + False + + + + + True + + + False + + + False + + + False + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/browserlayer.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/browserlayer.xml new file mode 100644 index 0000000..589cd70 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/browserlayer.xml @@ -0,0 +1,6 @@ + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/catalog.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/catalog.xml new file mode 100644 index 0000000..9558132 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/catalog.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/metadata.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/metadata.xml new file mode 100644 index 0000000..94821b2 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/metadata.xml @@ -0,0 +1,7 @@ + + + 20221212001 + + profile-plone.volto:default + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml new file mode 100644 index 0000000..2996aca --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.IMailSchema.xml @@ -0,0 +1,9 @@ + + + + Plone 6 Demo Site + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml new file mode 100644 index 0000000..0b2e681 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.base.interfaces.controlpanel.ISiteSchema.xml @@ -0,0 +1,9 @@ + + + + Plone 6 Demo Site + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml new file mode 100644 index 0000000..cd2730f --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/registry/plone.i18n.interfaces.ILanguageSchema.xml @@ -0,0 +1,12 @@ + + + + + en + + en + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/theme.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/theme.xml new file mode 100644 index 0000000..7f916aa --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/theme.xml @@ -0,0 +1,5 @@ + + + barceloneta + true + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/types.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/types.xml new file mode 100644 index 0000000..bed2b0d --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/types.xml @@ -0,0 +1,10 @@ + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/default/types/.gitkeep b/backend-volto/src/plone6demo/src/plone6demo/profiles/default/types/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/profiles/uninstall/browserlayer.xml b/backend-volto/src/plone6demo/src/plone6demo/profiles/uninstall/browserlayer.xml new file mode 100644 index 0000000..da03ab1 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/profiles/uninstall/browserlayer.xml @@ -0,0 +1,6 @@ + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/serializers/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/serializers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/serializers/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/serializers/configure.zcml new file mode 100644 index 0000000..fb8b793 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/serializers/configure.zcml @@ -0,0 +1,3 @@ + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/services/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/services/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/services/configure.zcml new file mode 100644 index 0000000..fb8b793 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/services/configure.zcml @@ -0,0 +1,3 @@ + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/setuphandlers/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/setuphandlers/__init__.py new file mode 100644 index 0000000..042d101 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/setuphandlers/__init__.py @@ -0,0 +1,11 @@ +from Products.CMFPlone.interfaces import INonInstallable +from zope.interface import implementer + + +@implementer(INonInstallable) +class HiddenProfiles(object): + def getNonInstallableProfiles(self): + """Hide uninstall profile from site-creation and quickinstaller.""" + return [ + "plone6demo:uninstall", + ] diff --git a/backend-volto/src/plone6demo/src/plone6demo/subscribers/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/subscribers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/subscribers/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/subscribers/configure.zcml new file mode 100644 index 0000000..fb8b793 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/subscribers/configure.zcml @@ -0,0 +1,3 @@ + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/testing.py b/backend-volto/src/plone6demo/src/plone6demo/testing.py new file mode 100644 index 0000000..ffe04a3 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/testing.py @@ -0,0 +1,52 @@ +from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE +from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_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 plone6demo + + +class PLONE6DEMOLayer(PloneSandboxLayer): + + defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,) + + def setUpZope(self, app, configurationContext): + # Load any other ZCML that is required for your tests. + # The z3c.autoinclude feature is disabled in the Plone fixture base + # layer. + import plone.restapi + + self.loadZCML(package=plone.restapi) + self.loadZCML(package=plone6demo) + + def setUpPloneSite(self, portal): + applyProfile(portal, "plone6demo:default") + applyProfile(portal, "plone6demo:initial") + + +PLONE6DEMO_FIXTURE = PLONE6DEMOLayer() + + +PLONE6DEMO_INTEGRATION_TESTING = IntegrationTesting( + bases=(PLONE6DEMO_FIXTURE,), + name="PLONE6DEMOLayer:IntegrationTesting", +) + + +PLONE6DEMO_FUNCTIONAL_TESTING = FunctionalTesting( + bases=(PLONE6DEMO_FIXTURE, WSGI_SERVER_FIXTURE), + name="PLONE6DEMOLayer:FunctionalTesting", +) + + +PLONE6DEMOACCEPTANCE_TESTING = FunctionalTesting( + bases=( + PLONE6DEMO_FIXTURE, + REMOTE_LIBRARY_BUNDLE_FIXTURE, + WSGI_SERVER_FIXTURE, + ), + name="PLONE6DEMOLayer:AcceptanceTesting", +) diff --git a/backend-volto/src/plone6demo/src/plone6demo/tests/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/tests/test_setup.py b/backend-volto/src/plone6demo/src/plone6demo/tests/test_setup.py new file mode 100644 index 0000000..bf27e55 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/tests/test_setup.py @@ -0,0 +1,62 @@ +"""Setup tests for this package.""" +from plone import api +from plone6demo.testing import PLONE6DEMO_INTEGRATION_TESTING # noqa: E501 +from plone.app.testing import setRoles +from plone.app.testing import TEST_USER_ID +from Products.CMFPlone.utils import get_installer + +import unittest + + +class TestSetup(unittest.TestCase): + """Test that plone6demo is properly installed.""" + + layer = PLONE6DEMO_INTEGRATION_TESTING + + def setUp(self): + """Custom shared utility setup for tests.""" + self.portal = self.layer["portal"] + self.setup = self.portal.portal_setup + self.installer = get_installer(self.portal, self.layer["request"]) + + def test_product_installed(self): + """Test if plone6demo is installed.""" + self.assertTrue(self.installer.is_product_installed("plone6demo")) + + def test_browserlayer(self): + """Test that IPLONE6DEMOLayer is registered.""" + from plone6demo.interfaces import IPLONE6DEMOLayer + from plone.browserlayer import utils + + self.assertIn(IPLONE6DEMOLayer, utils.registered_layers()) + + def test_latest_version(self): + """Test latest version of default profile.""" + self.assertEqual( + self.setup.getLastVersionForProfile("plone6demo:default")[0], + "20221212001", + ) + + +class TestUninstall(unittest.TestCase): + + layer = PLONE6DEMO_INTEGRATION_TESTING + + def setUp(self): + self.portal = self.layer["portal"] + self.installer = get_installer(self.portal, self.layer["request"]) + roles_before = api.user.get_roles(TEST_USER_ID) + setRoles(self.portal, TEST_USER_ID, ["Manager"]) + self.installer.uninstall_product("plone6demo") + setRoles(self.portal, TEST_USER_ID, roles_before) + + def test_product_uninstalled(self): + """Test if plone6demo is cleanly uninstalled.""" + self.assertFalse(self.installer.is_product_installed("plone6demo")) + + def test_browserlayer_removed(self): + """Test that IPLONE6DEMOLayer is removed.""" + from plone6demo.interfaces import IPLONE6DEMOLayer + from plone.browserlayer import utils + + self.assertNotIn(IPLONE6DEMOLayer, utils.registered_layers()) diff --git a/backend-volto/src/plone6demo/src/plone6demo/tests/test_upgrades.py_tmpl b/backend-volto/src/plone6demo/src/plone6demo/tests/test_upgrades.py_tmpl new file mode 100644 index 0000000..67509b6 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/tests/test_upgrades.py_tmpl @@ -0,0 +1,40 @@ +"""Upgrades tests for this package.""" +from parameterized import parameterized +from plone.app.testing import setRoles +from plone.app.testing import TEST_USER_ID +from plone6demo.testing import PLONE6DEMO_INTEGRATION_TESTING # noqa: E501 +from Products.GenericSetup.upgrade import listUpgradeSteps + +import unittest + + +class UpgradeStepIntegrationTest(unittest.TestCase): + + layer = PLONE6DEMO_INTEGRATION_TESTING + profile = "plone6demo:default" + + def setUp(self): + self.portal = self.layer["portal"] + self.setup = self.portal["portal_setup"] + setRoles(self.portal, TEST_USER_ID, ["Manager"]) + + def _match(self, item, source, dest): + source, dest = tuple([source]), tuple([dest]) + return item["source"] == source and item["dest"] == dest + + def available_steps(self) -> list: + """Test available steps.""" + steps = listUpgradeSteps(self.setup, self.profile, self.src) + steps = [s for s in steps if self._match(s[0], self.src, self.dst)] + return steps + + # Example of upgrade step test + @parameterized.expand( + [ + ("20221212001", "20230229001", 1), + ] + ) + def test_available(self, src, dst, expected): + """Test upgrade step is available.""" + steps = self.available_steps(src, dst) + self.assertEqual(len(steps), expected) diff --git a/backend-volto/src/plone6demo/src/plone6demo/upgrades/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/upgrades/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend-volto/src/plone6demo/src/plone6demo/upgrades/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/upgrades/configure.zcml new file mode 100644 index 0000000..14cf32d --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/upgrades/configure.zcml @@ -0,0 +1,19 @@ + + + + + diff --git a/backend-volto/src/plone6demo/src/plone6demo/vocabularies/__init__.py b/backend-volto/src/plone6demo/src/plone6demo/vocabularies/__init__.py new file mode 100644 index 0000000..cde7881 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/vocabularies/__init__.py @@ -0,0 +1,21 @@ +from plone6demo import _ +from zope.interface import provider +from zope.schema.interfaces import IVocabularyFactory +from zope.schema.vocabulary import SimpleTerm +from zope.schema.vocabulary import SimpleVocabulary + + +INDUSTRIES = [ + ("government", _("Government")), + ("ngo", _("NGO")), + ("edu", _("Education")), +] + + +@provider(IVocabularyFactory) +def industries_vocabulary(context): + """Vocabulary of industries.""" + terms = [] + for id_, title in INDUSTRIES: + terms.append(SimpleTerm(id_, id_, title)) + return SimpleVocabulary(terms) diff --git a/backend-volto/src/plone6demo/src/plone6demo/vocabularies/configure.zcml b/backend-volto/src/plone6demo/src/plone6demo/vocabularies/configure.zcml new file mode 100644 index 0000000..d8bb496 --- /dev/null +++ b/backend-volto/src/plone6demo/src/plone6demo/vocabularies/configure.zcml @@ -0,0 +1,10 @@ + + + + + diff --git a/devops/stacks/demo.plone.org.yml b/devops/stacks/demo.plone.org.yml index 59ff10b..2aea38a 100644 --- a/devops/stacks/demo.plone.org.yml +++ b/devops/stacks/demo.plone.org.yml @@ -84,10 +84,10 @@ services: - traefik.http.routers.demo-classic.middlewares=gzip,demo-classic-vhm backend_volto: - image: ghcr.io/plone/demo-backend:latest + image: ghcr.io/plone/demo-backend-volto:latest networks: - public - - demoplone + - demoplonevolto deploy: # Just one, as we do not have a shared database replicas: 1 @@ -118,7 +118,7 @@ services: - backend networks: - public - - demoplone + - demoplonevolto deploy: replicas: 1 placement: @@ -141,6 +141,7 @@ services: networks: public: external: true - driver: overlay demoplone: driver: overlay + demoplonevolto: + driver: overlay