Reputation: 83716
I have the following situation with LinguaPlone
I have pages a1-en, a1-fi an a1-sv
a1-fi and a1-sv think a1-en is the canonical translation
a1-en isCanonical()
returns False
This is because isCanonical()
checks if there are "translation of" references for the current item
a1-en is one unlucky page, as there is actually "translation of" reference, but it is a broken reference where the item pointed by UID reference is gone. (It checks only references by UID, not if the actual content item exists).
Now, I need to fix this situation somehow to make a1-en believe that it is canonical page again. I need to remove this one corrupted reference from the reference_catalog from "sourceUID" index which is being checked.
Questions
Are there automatic ways to maintain reference_catalog and clear broken entries
If not is what is the manual way to fix this one broken entry in reference_catalog
Upvotes: 1
Views: 197
Reputation: 83716
Like this:
badCanonical = app.Plone.en.offering.restaurants
badCanonical.isCanonical() # False - contains a corrupted translationOf link
badCanonical.getTranslations() # Get list of what translations should exist
cat = app.Plone.reference_catalog
cat.getReferences(badCanonical, relationship="translationOf") # Displays UID referring object not existing
# Delete forward relationships
for b in cat.getReferences(badCanonical, "translationOf"): cat._deleteReference(b)
badCanonical.isCanonical() # True - fixed
badCanonical.getTranslations()
# Check that one of the translated versions still work
translated = app.Plone.sv["kalajoki-erbjuder"].restauranger
translated.isCanonical()
translated.getTranslations()
Upvotes: 2