Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max File Size Validator #4

Merged
merged 8 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
3.2.2 (unreleased)
------------------

- Nothing changed yet.
- Add filesize upload limit. [ThibautBorn]

- update Dutch translations [ThibautBorn]


3.2.1 (2022-12-01)
Expand Down
6 changes: 6 additions & 0 deletions src/collective/easyform/browser/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ class IEasyFormControlPanel(Interface):
default=u",",
)

max_filesize = schema.Int(
title=_(u"Filesize limit"),
description=_(u"Set the maximum filesize (in bytes) that users should be able to upload."),
required=False
)


class EasyFormControlPanelForm(RegistryEditForm):
schema = IEasyFormControlPanel
Expand Down
9 changes: 9 additions & 0 deletions src/collective/easyform/fields.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@
name="collective.easyform.fields.Likert"
component=".fields.LikertHandler"
/>
<adapter
provides="z3c.form.interfaces.IValidator"
for="collective.easyform.interfaces.IEasyForm
*
*
plone.namedfile.interfaces.INamedField
*"
factory="collective.easyform.validators.FileSizeValidator"
/>
</configure>
14 changes: 9 additions & 5 deletions src/collective/easyform/locales/collective.easyform.pot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# --- PLEASE EDIT THE LINES BELOW CORRECTLY ---
# SOME DESCRIPTIVE TITLE.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#--- PLEASE EDIT THE LINES BELOW CORRECTLY ---
#SOME DESCRIPTIVE TITLE.
#FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
Expand Down Expand Up @@ -42,7 +42,7 @@ msgstr ""
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr ""
Expand Down Expand Up @@ -92,6 +92,10 @@ msgstr ""
msgid "Export"
msgstr ""

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr ""
Expand Down Expand Up @@ -166,7 +170,7 @@ msgstr ""
msgid "Thanks Page"
msgstr ""

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ msgstr "Adressierung"
msgid "Advanced"
msgstr "Erweitert"

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "Erlaubte Felder"
Expand Down Expand Up @@ -91,6 +91,10 @@ msgstr "XML Feldmodell bearbeiten"
msgid "Export"
msgstr "Exportieren"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Feldmodell"
Expand Down Expand Up @@ -165,7 +169,7 @@ msgstr ""
msgid "Thanks Page"
msgstr "Danke-Seite"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr "Diese Felder stehen für das Formular zur Verfügung."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ msgstr ""
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr ""
Expand Down Expand Up @@ -89,6 +89,10 @@ msgstr ""
msgid "Export"
msgstr ""

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr ""
Expand Down Expand Up @@ -163,7 +167,7 @@ msgstr ""
msgid "Thanks Page"
msgstr ""

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ msgstr "Direcciónes"
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "Campos permitidos"
Expand Down Expand Up @@ -94,6 +94,10 @@ msgstr "Editar XML de Modelo de Campos"
msgid "Export"
msgstr "Exportar"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Modelo de campos"
Expand Down Expand Up @@ -168,7 +172,7 @@ msgstr ""
msgid "Thanks Page"
msgstr "Página de agradecimiento"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr "Estos campos están disponibles para tus formularios"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ msgstr "Helbideak"
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "Onartutako eremuak"
Expand Down Expand Up @@ -91,6 +91,10 @@ msgstr "Eremuen XML eredua editatu"
msgid "Export"
msgstr "Esportatu"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Eremuen eredua"
Expand Down Expand Up @@ -165,7 +169,7 @@ msgstr ""
msgid "Thanks Page"
msgstr "Eskertza-orria"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr "Eremu hauek gehitu daitezke formularioetan."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ msgstr "Indirizzi"
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "Campi consentiti"
Expand Down Expand Up @@ -90,6 +90,10 @@ msgstr "Modifica l'XML dei campi"
msgid "Export"
msgstr "Esporta"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Modello dei campi"
Expand Down Expand Up @@ -164,7 +168,7 @@ msgstr ""
msgid "Thanks Page"
msgstr "Pagina di ringraziamento"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ msgid "Advanced"
msgstr "上級者向け設定"

# コントロールパネル内
#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "追加許可フィールド"
Expand Down Expand Up @@ -113,6 +113,10 @@ msgstr " XML アクションズフィールドを編集"
msgid "Export"
msgstr "エクスポート"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

# 場所不明
#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
Expand Down Expand Up @@ -205,7 +209,7 @@ msgid "Thanks Page"
msgstr "送信完了ページ"

# コントロールパネル
#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr "このフォームで利用できるフィールドは、以下の通りです"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ msgstr "Adressering"
msgid "Advanced"
msgstr "Geavanceerd"

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "Toegestane velden"

#: collective/easyform/browser/controlpanel.py:42
#: collective/easyform/browser/saveddata_form.pt:34
msgid "CSV delimiter"
msgstr ""
msgstr "CSV-scheidingsteken"

#: collective/easyform/browser/saveddata_form.pt:37
msgid "CSV delimiter is required."
Expand Down Expand Up @@ -93,6 +93,10 @@ msgstr "Bewerk XML veldenmodel"
msgid "Export"
msgstr "Exporteer"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Veldenmodel"
Expand Down Expand Up @@ -161,13 +165,17 @@ msgstr "Opslag"

#: collective/easyform/browser/controlpanel.py:44
msgid "Set the default delimiter for CSV download."
msgstr ""
msgstr "Stel het standaardscheidingsteken in voor CSV-downloads"

#: collective/easyform/browser/controlpanel.py:39
msgid "Set the maximum filesize (in bytes) that users should be able to upload."
msgstr "Maximale grootte (in bytes) voor bestanden die kunnen worden opgeladen"

#: collective/easyform/interfaces/easyform.py:117
msgid "Thanks Page"
msgstr "'Bedankt' pagina"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr "Deze velden zijn beschikbaar voor het formulier"
Expand Down Expand Up @@ -889,7 +897,7 @@ msgstr "Het bestandstype ${ftype} is niet toegestaan ​​als upload"

#: collective/easyform/browser/view.py:399
msgid "msg_file_too_big"
msgstr "Het geüploade bestand is groter dan $ {size} bytes."
msgstr "Het geüploade bestand is groter dan ${size} bytes."

#. Default: "Comma-Separated Values"
#: collective/easyform/vocabularies.py:80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ msgstr "Endereçamento"
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr "Campos permitidos"
Expand Down Expand Up @@ -89,6 +89,10 @@ msgstr "Editar o XML do modelo de campos"
msgid "Export"
msgstr "Exportar"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Modelo de campos"
Expand Down Expand Up @@ -163,7 +167,7 @@ msgstr ""
msgid "Thanks Page"
msgstr "Página de agradecimento"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr "Estes campos estão disponíveis para seus formulários"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ msgstr "Адреси"
msgid "Advanced"
msgstr ""

#: collective/easyform/browser/controlpanel.py:28
#: collective/easyform/browser/controlpanel.py:20
#: collective/easyform/profiles/default/registry.xml
msgid "Allowed Fields"
msgstr ""
Expand Down Expand Up @@ -92,6 +92,10 @@ msgstr "Редагувати XML модель полів"
msgid "Export"
msgstr "Експортувати"

#: collective/easyform/interfaces/fields.py:94
msgid "Field depends on"
msgstr ""

#: collective/easyform/interfaces/easyform.py:90
msgid "Fields Model"
msgstr "Модель полів"
Expand Down Expand Up @@ -166,7 +170,7 @@ msgstr ""
msgid "Thanks Page"
msgstr "Сторінка подяки"

#: collective/easyform/browser/controlpanel.py:29
#: collective/easyform/browser/controlpanel.py:21
#: collective/easyform/profiles/default/registry.xml
msgid "This Fields are available for your forms."
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion src/collective/easyform/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<metadata>
<version>1011</version>
<version>1012</version>
</metadata>
12 changes: 12 additions & 0 deletions src/collective/easyform/profiles/default/registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,16 @@
interface="collective.easyform.browser.controlpanel.IEasyFormControlPanel"
name="easyform.csv_delimiter"></record>

<record name="easyform.max_filesize"
interface="collective.easyform.browser.controlpanel.IEasyFormControlPanel"
field="max_filesize">
</record>

<record name="plone.icon.contenttype/easyform">
<field type="plone.registry.field.TextLine">
<title>Easyform</title>
</field>
<value key="resource">++plone++bootstrap-icons/ui-checks.svg</value>
</record>

</registry>
Loading
Loading