Skip to content

Commit

Permalink
Merge branch 'main' into datatable
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico authored Apr 10, 2024
2 parents 73a1803 + 65310d2 commit 88093ee
Show file tree
Hide file tree
Showing 22 changed files with 487 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ omit =
*/lib/*
*.txt
*.rst

*/upgrades.py
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
- python: "3.11"
plone: "52"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache eggs
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: eggs
key: ${{ runner.OS }}-build-python${{ matrix.python }}-${{ matrix.plone }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ report.html
.tox/
reports/
pyvenv.cfg
__pycache__
# excludes
*~
2 changes: 2 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[settings]
profile=plone
12 changes: 11 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ Changelog
[mamico]
- Fix: if there are multiple forms on a page, each csv button downloads the record of all the forms,
now if there is a block_id parameter, the csv is filtered on that.
- Breaking change: clear data method changed from GET to DELETE
[mamico]
- Fix: with multiple blocks on the same page, all data is deleted.
Now, if you pass a parameter block_id, only the records related to the
block are deleted.
[mamico]
- Feat: clear data restapi accept a parameter for remove the expired records
[mamico]
- data cleaning script
[mamico]
- Allow attaching an XML version of the form data to the sent email #22
[JeffersonBledsoe]
Expand All @@ -22,7 +31,8 @@ Changelog
[JeffersonBledsoe]
- Added support for sending emails as a table #31
[JeffersonBledsoe]

- Add validation for email fields.
[cekk]

2.7.0 (2023-04-03)
------------------
Expand Down
34 changes: 31 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ Calling with "expand=true", this endpoint returns the stored data::

> curl -i -X GET http://localhost:8080/Plone/my-form/@form-data -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin

Specifying a block_id parameter returns only the records associated with a specific block on the page.

> curl -i -X GET http://localhost:8080/Plone/my-form/@form-data?block_id=123456789 -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin

And replies with something similar::

{
"@id": "http://localhost:8080/Plone/my-form/@form-data",
"@id": "http://localhost:8080/Plone/my-form/@form-data?block_id=123456789",
"items": [
{
"block_id": "123456789",
Expand All @@ -73,7 +76,8 @@ And replies with something similar::
},
...
],
"items_total": 42
"items_total": 42,
"expired_total": 2
}

@form-data-export
Expand All @@ -90,8 +94,12 @@ If form fields changed between some submissions, you will see also columns relat

Reset the store (only for users that have **Modify portal content** permission)::

> curl -i -X GET http://localhost:8080/Plone/my-form/@form-data-clear -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin
> curl -i -X DELETE http://localhost:8080/Plone/my-form/@form-data-clear --data-raw '{block_id: bbb}' -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin

Optional paramaters could be passed in the payload:

* `block_id` to delete only data related to a specific block on the page, otherwise data from all form blocks on the page will be deleted
* `expired` a boolean that, if `true`, removes only records older than the value of days specified in the block configuration (the above `block_id` parameter is required)

Form actions
============
Expand Down Expand Up @@ -251,6 +259,26 @@ It is possible to configure some headers from the form POST request to be includ
- `HTTP_USER_AGENT`
- `HTTP_REFERER`

Data retention
==============

There is a script that implements data cleansing (i.e. for GDPR purpose)::

bin/instance -OPlone run bin/formsupport_data_cleansing --help
Usage: interpreter [OPTIONS]

bin/instance -OPlone run bin/formsupport_data_cleansing [--dryrun|--no-dryrun]

Options:
--dryrun --dryrun (default) simulate, --no-dryrun actually save the
changes

--help Show this message and exit.


The form block as an integer field `remove_data_after_days`, the retention days can be defined on a single block,
If the value is lower or equal to `0` there is no data cleaning for the specific form.

Examples
========

Expand Down
10 changes: 2 additions & 8 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ extends =
# test_plone43.cfg
# test_plone50.cfg
# test_plone51.cfg
test_plone52.cfg
# test_plone52.cfg
test_plone60.cfg

[versions]
flake8 = 4.0.1
pyflakes = 2.4.0
pycodestyle = 2.8.0
multipart = 0.2.4
pyScss = 1.4.0
robotframework = 5.0
plone.rest = 2.0.0a5
2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-c constraints_plone52.txt
-c constraints_plone60.txt
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"plone.restapi",
"plone.app.dexterity",
"souper.plone",
"click",
],
extras_require={
"hcaptcha": [
Expand Down Expand Up @@ -89,5 +90,6 @@
target = plone
[console_scripts]
update_locale = collective.volto.formsupport.locales.update:update_locale
formsupport_data_cleansing = collective.volto.formsupport.scripts.cleansing:main
""",
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2023-05-24 00:33+0000\n"
"POT-Creation-Date: 2024-01-10 11:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -21,11 +21,11 @@ msgstr ""
msgid "Google ReCaptcha"
msgstr ""

#: collective/volto/formsupport/captcha/hcaptcha.py:13
#: collective/volto/formsupport/captcha/hcaptcha.py:14
msgid "HCaptcha"
msgstr ""

#: collective/volto/formsupport/captcha/hcaptcha.py:62
#: collective/volto/formsupport/captcha/hcaptcha.py:63
msgid "HCaptcha Invisible"
msgstr ""

Expand All @@ -37,8 +37,8 @@ msgstr ""
msgid "Installs the collective.volto.formsupport add-on."
msgstr ""

#: collective/volto/formsupport/captcha/hcaptcha.py:43
#: collective/volto/formsupport/captcha/norobots.py:53
#: collective/volto/formsupport/captcha/hcaptcha.py:44
#: collective/volto/formsupport/captcha/norobots.py:51
#: collective/volto/formsupport/captcha/recaptcha.py:42
msgid "No captcha token provided."
msgstr ""
Expand All @@ -47,8 +47,8 @@ msgstr ""
msgid "NoRobots ReCaptcha Support"
msgstr ""

#: collective/volto/formsupport/captcha/hcaptcha.py:55
#: collective/volto/formsupport/captcha/norobots.py:69
#: collective/volto/formsupport/captcha/hcaptcha.py:56
#: collective/volto/formsupport/captcha/norobots.py:67
#: collective/volto/formsupport/captcha/recaptcha.py:54
msgid "The code you entered was wrong, please enter the new one."
msgstr ""
Expand All @@ -66,17 +66,17 @@ msgid "Volto: Form support (uninstall)"
msgstr ""

#. Default: "Attachments too big. You uploaded ${uploaded_str}, but limit is ${max} MB. Try to compress files."
#: collective/volto/formsupport/restapi/services/submit_form/post.py:158
#: collective/volto/formsupport/restapi/services/submit_form/post.py:185
msgid "attachments_too_big"
msgstr ""

#. Default: "Block with @type \"form\" and id \"$block\" not found in this context: $context"
#: collective/volto/formsupport/restapi/services/submit_form/post.py:99
#: collective/volto/formsupport/restapi/services/submit_form/post.py:101
msgid "block_form_not_found_label"
msgstr ""

#. Default: "Empty form data."
#: collective/volto/formsupport/restapi/services/submit_form/post.py:125
#: collective/volto/formsupport/restapi/services/submit_form/post.py:127
msgid "empty_form_data"
msgstr ""

Expand All @@ -86,17 +86,17 @@ msgid "honeypot_error"
msgstr ""

#. Default: "Unable to send confirm email. Please retry later or contact site administator."
#: collective/volto/formsupport/restapi/services/submit_form/post.py:72
#: collective/volto/formsupport/restapi/services/submit_form/post.py:74
msgid "mail_send_exception"
msgstr ""

#. Default: "You need to set at least one form action between \"send\" and \"store\"."
#: collective/volto/formsupport/restapi/services/submit_form/post.py:114
#: collective/volto/formsupport/restapi/services/submit_form/post.py:116
msgid "missing_action"
msgstr ""

#. Default: "Missing block_id"
#: collective/volto/formsupport/restapi/services/submit_form/post.py:92
#: collective/volto/formsupport/restapi/services/submit_form/post.py:94
msgid "missing_blockid_label"
msgstr ""

Expand All @@ -106,11 +106,16 @@ msgid "send_mail_text"
msgstr ""

#. Default: "Form submission data for ${title}"
#: collective/volto/formsupport/browser/send_mail_template_table.pt:7
#: collective/volto/formsupport/browser/send_mail_template_table.pt:12
msgid "send_mail_text_table"
msgstr ""

#. Default: "Missing required field: subject or from."
#: collective/volto/formsupport/restapi/services/submit_form/post.py:236
#: collective/volto/formsupport/restapi/services/submit_form/post.py:271
msgid "send_required_field_missing"
msgstr ""

#. Default: "Email not valid in \"${field}\" field."
#: collective/volto/formsupport/restapi/services/submit_form/post.py:157
msgid "wrong_email"
msgstr ""
Loading

0 comments on commit 88093ee

Please sign in to comment.