-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cekk_disable_automatic_field
- Loading branch information
Showing
19 changed files
with
271 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/sh | ||
# Let's use Python 3.8 here, to make it easier to switch between Plone 5.2 and 6.0. | ||
python3.8 -m venv . | ||
./bin/pip install -r requirements.txt | ||
./bin/buildout -c buildout.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from zope.i18nmessageid import MessageFactory | ||
|
||
|
||
_ = MessageFactory("collective.honeypot") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#--- PLEASE EDIT THE LINES BELOW CORRECTLY --- | ||
#SOME DESCRIPTIVE TITLE. | ||
#FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"POT-Creation-Date: 2022-09-01 15:28+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" | ||
"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: collective.honeypot\n" | ||
|
||
#. Default: "Posting denied due to possible spamming. Please contact us if we are wrong." | ||
#: collective/honeypot/utils.py:59 | ||
msgid "post_denied_label" | ||
msgstr "" |
25 changes: 25 additions & 0 deletions
25
collective/honeypot/locales/es/LC_MESSAGES/collective.honeypot.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of collective.honeypot.pot to Spanish | ||
# Leonardo J. Caballero G. <[email protected]>, 2023. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: collective.honeypot\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-09-01 15:28+0000\n" | ||
"PO-Revision-Date: 2023-05-13 12:20-0400\n" | ||
"Last-Translator: Leonardo J. Caballero G. <[email protected]>\n" | ||
"Language: es\n" | ||
"Language-Team: ES <[email protected]>\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"Preferred-Encodings: utf-8\n" | ||
"MIME-Version: 1.0\n" | ||
"Language-Code: es\n" | ||
"Language-Name: Español\n" | ||
"Domain: collective.honeypot\n" | ||
"X-Is-Fallback-For: es-ar es-bo es-cl es-co es-cr es-do es-ec es-es es-sv es-gt es-hn es-mx es-ni es-pa es-py es-pe es-pr es-us es-uy es-ve\n" | ||
|
||
#. Default: "Posting denied due to possible spamming. Please contact us if we are wrong." | ||
#: collective/honeypot/utils.py:59 | ||
msgid "post_denied_label" | ||
msgstr "Error al enviar el formulario. Póngase en contacto con el administrador del sitio si cree que se trata de un error." |
23 changes: 23 additions & 0 deletions
23
collective/honeypot/locales/it/LC_MESSAGES/collective.honeypot.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#--- PLEASE EDIT THE LINES BELOW CORRECTLY --- | ||
#SOME DESCRIPTIVE TITLE. | ||
#FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"POT-Creation-Date: 2022-09-01 15:28+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" | ||
"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: collective.honeypot\n" | ||
|
||
#. Default: "Posting denied due to possible spamming. Please contact us if we are wrong." | ||
#: collective/honeypot/utils.py:59 | ||
msgid "post_denied_label" | ||
msgstr "Sottomissione del form bloccata per possibile spam. Per favore contatta l'amministratore del sito se ritieni che sia un'errore." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# i18ndude should be available in current $PATH (eg by running | ||
# ``export PATH=$PATH:$BUILDOUT_DIR/bin`` when i18ndude is located in your buildout's bin directory) | ||
# | ||
# For every language you want to translate into you need a | ||
# locales/[language]/LC_MESSAGES/collective.honeypot.po | ||
# (e.g. locales/de/LC_MESSAGES/collective.honeypot.po) | ||
|
||
domain=collective.honeypot | ||
|
||
i18ndude rebuild-pot --pot $domain.pot --create $domain ../ | ||
i18ndude merge --pot $domain.pot --merge manual.pot | ||
i18ndude sync --pot $domain.pot */LC_MESSAGES/$domain.po |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- coding: utf-8 -*- | ||
from collective.honeypot.testing import HONEYPOT_API_FUNCTIONAL_TESTING | ||
from plone.app.testing import setRoles | ||
from plone.app.testing import SITE_OWNER_NAME | ||
from plone.app.testing import SITE_OWNER_PASSWORD | ||
from plone.app.testing import TEST_USER_ID | ||
from plone.app.testing import TEST_USER_NAME | ||
from plone.app.testing import TEST_USER_PASSWORD | ||
from plone.restapi.testing import RelativeSession | ||
from zExceptions import Forbidden | ||
|
||
import transaction | ||
import unittest | ||
|
||
|
||
class HoneypotRestApiTestCase(unittest.TestCase): | ||
layer = HONEYPOT_API_FUNCTIONAL_TESTING | ||
|
||
def setUp(self): | ||
self.app = self.layer["app"] | ||
self.portal = self.layer["portal"] | ||
self.portal_url = self.portal.absolute_url() | ||
setRoles(self.portal, TEST_USER_ID, ["Manager"]) | ||
|
||
self.api_session = RelativeSession(self.portal_url) | ||
self.api_session.headers.update({"Accept": "application/json"}) | ||
self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) | ||
|
||
def test_restapi_protected_endpoint(self): | ||
""" | ||
@email-notification use sendto_form Plone view that is patched in this package | ||
""" | ||
response = self.api_session.post( | ||
self.portal_url + "/@email-notification", | ||
json={ | ||
"from": "[email protected]", | ||
"message": "Just want to say hi.", | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, 204) | ||
|
||
response = self.api_session.post( | ||
self.portal_url + "/@email-notification", | ||
json={ | ||
"from": "[email protected]", | ||
"message": "Just want to say hi.", | ||
"protected_1": "foo", | ||
}, | ||
) | ||
self.assertEqual(response.status_code, 403) | ||
|
||
def test_restapi_general_post_protected(self): | ||
response = self.api_session.post( | ||
self.portal_url + "/@email-send", | ||
json={ | ||
"to": "[email protected]", | ||
"from": "[email protected]", | ||
"message": "Just want to say hi.", | ||
}, | ||
) | ||
|
||
self.assertEqual(response.status_code, 204) | ||
|
||
response = self.api_session.post( | ||
self.portal_url + "/@email-send", | ||
json={ | ||
"to": "[email protected]", | ||
"from": "[email protected]", | ||
"message": "Just want to say hi.", | ||
"protected_1": "foo", | ||
}, | ||
) | ||
self.assertEqual(response.status_code, 403) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
setuptools==42.0.2 | ||
zc.buildout==2.13.8 | ||
wheel==0.37.1 | ||
|
||
# Windows specific down here (has to be installed here, fails in buildout) | ||
# Dependency of zope.sendmail: | ||
pywin32 ; platform_system == 'Windows' | ||
# SSL Certs on Windows, because Python is missing them otherwise: | ||
certifi ; platform_system == 'Windows' | ||
# Dependency of collective.recipe.omelette: | ||
ntfsutils ; platform_system == 'Windows' and python_version < '3.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ ignore = | |
.installed.cfg | ||
*.cfg | ||
bootstrap.sh | ||
requirements.txt | ||
requirements*.txt | ||
tox.ini | ||
|
||
[bdist_wheel] | ||
|
Oops, something went wrong.