diff --git a/CHANGES.rst b/CHANGES.rst index dd89596..4027cae 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,11 @@ Changelog 3.0.1 (unreleased) ------------------ -- Nothing changed yet. +- Fix querying the registry for the case when collective.clamav is not installed, + properly remove registry settings in uninstall step. + [tschorr] +- Add a flag to enable/disable virus scanning in the configlet. + [tschorr] 3.0.0 (2021-01-25) diff --git a/plone-5.2.x.cfg b/plone-5.2.x.cfg index 5783c93..6c45e72 100644 --- a/plone-5.2.x.cfg +++ b/plone-5.2.x.cfg @@ -14,5 +14,5 @@ virtualenv = 20.0.35 # Error: The requirement ('pep517>=0.9') is not allowed by your [versions] constraint (0.8.2) pep517 = 0.9.1 -# Error: The requirement ('importlib-metadata>=1') is not allowed by your [versions] constraint (0.23) -importlib-metadata = 2.0.0 +# Error: The requirement ('importlib-metadata>=1') is not allowed by your [versions] constraint (2.0.0) +importlib-metadata = 3.10.1 diff --git a/src/collective/clamav/configure.zcml b/src/collective/clamav/configure.zcml index 35a648b..80ccf62 100644 --- a/src/collective/clamav/configure.zcml +++ b/src/collective/clamav/configure.zcml @@ -6,6 +6,7 @@ + diff --git a/src/collective/clamav/interfaces.py b/src/collective/clamav/interfaces.py index a0872d8..411cd0c 100644 --- a/src/collective/clamav/interfaces.py +++ b/src/collective/clamav/interfaces.py @@ -22,6 +22,12 @@ class ICollectiveClamavLayer(IDefaultBrowserLayer): class IAVScannerSettings(Interface): """ Schema for the clamav settings """ + clamav_enabled = schema.Bool( + title=_(u'Enable Clamav virus scanning'), + description=_(u'If set to true virus scanning will be enabled '), + default=True, + required=True) + clamav_connection = schema.Choice( title=_(u'Connection type to clamd'), description=_(u'Choose whether clamd is accessible through local ' diff --git a/src/collective/clamav/profiles/default/metadata.xml b/src/collective/clamav/profiles/default/metadata.xml index b62c756..e0fbdef 100644 --- a/src/collective/clamav/profiles/default/metadata.xml +++ b/src/collective/clamav/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 1000 + 1001 diff --git a/src/collective/clamav/profiles/default/propertiestool.xml b/src/collective/clamav/profiles/default/propertiestool.xml index 6e3d965..c09ace1 100644 --- a/src/collective/clamav/profiles/default/propertiestool.xml +++ b/src/collective/clamav/profiles/default/propertiestool.xml @@ -2,6 +2,7 @@ clamav Properties + True net /var/run/clamd localhost diff --git a/src/collective/clamav/profiles/uninstall/registry.xml b/src/collective/clamav/profiles/uninstall/registry.xml new file mode 100644 index 0000000..1783341 --- /dev/null +++ b/src/collective/clamav/profiles/uninstall/registry.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/collective/clamav/upgrades.py b/src/collective/clamav/upgrades.py new file mode 100644 index 0000000..004e3a8 --- /dev/null +++ b/src/collective/clamav/upgrades.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +default_profile = 'profile-collective.clamav:default' + + +def upgrade_site(setup): + setup.runImportStepFromProfile(default_profile, 'plone.app.registry') diff --git a/src/collective/clamav/upgrades.zcml b/src/collective/clamav/upgrades.zcml new file mode 100644 index 0000000..c38a078 --- /dev/null +++ b/src/collective/clamav/upgrades.zcml @@ -0,0 +1,17 @@ + + + + + diff --git a/src/collective/clamav/validator.py b/src/collective/clamav/validator.py index b9e489f..1ae80d9 100644 --- a/src/collective/clamav/validator.py +++ b/src/collective/clamav/validator.py @@ -22,8 +22,11 @@ def _scanBuffer(buffer): return '' registry = getUtility(IRegistry) - settings = registry.forInterface(IAVScannerSettings) # noqa: P001 - if settings is None: + try: + settings = registry.forInterface(IAVScannerSettings) # noqa: P001 + except KeyError: # Product is not installed + return '' + if not settings.clamav_enabled: return '' scanner = getUtility(IAVScanner)