Skip to content

Commit

Permalink
[fc] Repository: plone.app.linkintegrity
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2017-09-27T18:41:00+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.linkintegrity@b64552c

Prevent handler from doing anything when linkintegrity is switched of (#60)

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/handlers.py
  • Loading branch information
pbauer committed Sep 27, 2017
1 parent b8db12b commit 38efb66
Showing 1 changed file with 45 additions and 151 deletions.
196 changes: 45 additions & 151 deletions last_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,173 +2,67 @@ Repository: plone.app.linkintegrity


Branch: refs/heads/master
Date: 2017-09-27T10:00:28+02:00
Date: 2017-09-27T18:41:00+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.linkintegrity/commit/8fe0e91aabd12e1c6910910773ebb1eb87fd66bf
Commit: https://github.com/plone/plone.app.linkintegrity/commit/b64552cb4a2dd83a119f8d0e3f1daa7075215bfb

Fix view @@updateLinkIntegrityInformation after Language='all' no longer works
Prevent handler from doing anything when linkintegrity is switched of (#60)

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/browser/update.py
M plone/app/linkintegrity/handlers.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 2efd283..d3679e0 100644
index d3679e0..4487b18 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -18,6 +18,9 @@ Bug fixes:
paragraph to be always visible, even without link breaches.
[arsenico13]
@@ -10,7 +10,9 @@ Breaking changes:

+- Fix view @@updateLinkIntegrityInformation after Language='all' no longer works.
+ [pbauer]
+

3.3.2 (2017-08-14)
------------------
diff --git a/plone/app/linkintegrity/browser/update.py b/plone/app/linkintegrity/browser/update.py
index c4ddfe1..0ea9cb5 100644
--- a/plone/app/linkintegrity/browser/update.py
+++ b/plone/app/linkintegrity/browser/update.py
@@ -11,25 +11,6 @@
from zExceptions import NotFound

import logging
-import pkg_resources
-
-
-# Is there a multilingual addon?
-try:
- pkg_resources.get_distribution('Products.LinguaPlone')
-except pkg_resources.DistributionNotFound:
- HAS_MULTILINGUAL = False
-else:
- HAS_MULTILINGUAL = True
-
-if not HAS_MULTILINGUAL:
- try:
- pkg_resources.get_distribution('plone.app.multilingual')
- except pkg_resources.DistributionNotFound:
- HAS_MULTILINGUAL = False
- else:
- HAS_MULTILINGUAL = True
-
logger = logging.getLogger(__name__)


@@ -69,8 +50,6 @@ def update(self):
catalog = getToolByName(self.context, 'portal_catalog')
count = 0
query = {}
- if HAS_MULTILINGUAL and 'Language' in catalog.indexes():
- query['Language'] = 'all'

for brain in catalog(query):
try:


Repository: plone.app.linkintegrity


Branch: refs/heads/master
Date: 2017-09-27T12:54:23+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.linkintegrity/commit/9cba64c3995527d1d91a67ece8bcbe68dd8919e3

remove obsolete query

Files changed:
M plone/app/linkintegrity/browser/update.py

diff --git a/plone/app/linkintegrity/browser/update.py b/plone/app/linkintegrity/browser/update.py
index 0ea9cb5..4891658 100644
--- a/plone/app/linkintegrity/browser/update.py
+++ b/plone/app/linkintegrity/browser/update.py
@@ -49,9 +49,8 @@ def __call__(self):
def update(self):
catalog = getToolByName(self.context, 'portal_catalog')
count = 0
- query = {}
New features:

- for brain in catalog(query):
+ for brain in catalog():
try:
obj = brain.getObject()
except (AttributeError, NotFound, KeyError):


Repository: plone.app.linkintegrity


Branch: refs/heads/master
Date: 2017-09-27T14:27:11+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.app.linkintegrity/commit/9d2dc86bb437efee771c9c4b7e21dd2f6d532a7b

Merge pull request #59 from plone/fix_updateLinkIntegrityInformation

Fix view @@updateLinkIntegrityInformation

Files changed:
M CHANGES.rst
M plone/app/linkintegrity/browser/update.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 2efd283..d3679e0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -18,6 +18,9 @@ Bug fixes:
paragraph to be always visible, even without link breaches.
[arsenico13]

+- Fix view @@updateLinkIntegrityInformation after Language='all' no longer works.
-- *add item here*
+- Prevent linkintegrity-handler from doing anything when it is switched of in the registry.
+ This change also prevents some issues in migration from AT to DX since linkintegrity is disabled during the migration.
+ [pbauer]
+

3.3.2 (2017-08-14)
------------------
diff --git a/plone/app/linkintegrity/browser/update.py b/plone/app/linkintegrity/browser/update.py
index c4ddfe1..4891658 100644
--- a/plone/app/linkintegrity/browser/update.py
+++ b/plone/app/linkintegrity/browser/update.py
@@ -11,25 +11,6 @@
from zExceptions import NotFound
Bug fixes:

diff --git a/plone/app/linkintegrity/handlers.py b/plone/app/linkintegrity/handlers.py
index 3749765..4ce0948 100644
--- a/plone/app/linkintegrity/handlers.py
+++ b/plone/app/linkintegrity/handlers.py
@@ -5,7 +5,9 @@
from plone.app.linkintegrity.interfaces import IRetriever
from plone.app.uuid.utils import uuidToObject
from plone.dexterity.interfaces import IDexterityContent
+from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName
+from Products.CMFPlone.interfaces import IEditingSchema
from Products.CMFPlone.interfaces import IPloneSiteRoot
from urllib import unquote
from urlparse import urlsplit
@@ -103,7 +105,7 @@ def getObjectsFromLinks(base, links):

import logging
-import pkg_resources
-
-
-# Is there a multilingual addon?
-try:
- pkg_resources.get_distribution('Products.LinguaPlone')
-except pkg_resources.DistributionNotFound:
- HAS_MULTILINGUAL = False
-else:
- HAS_MULTILINGUAL = True
-
-if not HAS_MULTILINGUAL:
- try:
- pkg_resources.get_distribution('plone.app.multilingual')
- except pkg_resources.DistributionNotFound:
- HAS_MULTILINGUAL = False
- else:
- HAS_MULTILINGUAL = True
-
logger = logging.getLogger(__name__)

def modifiedContent(obj, event):
- """ a dexterity based object was modified """
+ """Object was modified, cloned or created."""
if not check_linkintegrity_dependencies(obj):
return
retriever = IRetriever(obj, None)
@@ -146,6 +148,13 @@ def updateReferences(obj, refs):

@@ -68,11 +49,8 @@ def __call__(self):
def update(self):
catalog = getToolByName(self.context, 'portal_catalog')
count = 0
- query = {}
- if HAS_MULTILINGUAL and 'Language' in catalog.indexes():
- query['Language'] = 'all'

- for brain in catalog(query):
+ for brain in catalog():
try:
obj = brain.getObject()
except (AttributeError, NotFound, KeyError):
def check_linkintegrity_dependencies(obj):
+ try:
+ reg = getUtility(IRegistry)
+ editing_settings = reg.forInterface(IEditingSchema, prefix='plone')
+ except (ComponentLookupError, KeyError):
+ return False
+ if not editing_settings.enable_link_integrity_checks:
+ return False
if not getToolByName(obj, 'portal_url', None):
# `getObjectFromLinks` is not possible without access
# to `portal_url`


0 comments on commit 38efb66

Please sign in to comment.