Folders don't show up in navigation, KeyError while editing them - plone

Recently we noticed that some (published) folders in our Plone 3.3.5 site are no longer visible in the navigation and folder listing views. While trying to set a new effective date (it's set in the past, so that is not the problem) on them i get a KeyError:
Traceback (innermost last):
Module ZPublisher.Publish, line 125, in publish
Module Zope2.App.startup, line 238, in commit
Module transaction._manager, line 96, in commit
Module transaction._transaction, line 389, in commit
Module transaction._transaction, line 445, in _callBeforeCommitHooks
Module collective.indexing.transactions, line 57, in before_commit
Module collective.indexing.queue, line 149, in process
Module collective.indexing.indexer, line 89, in unindex
Module collective.indexing.indexer, line 71, in unindex
Module Products.CMFSquidTool.queue, line 160, in unindexObject
Module Products.CMFSquidTool.patch, line 24, in call
Module Products.Archetypes.CatalogMultiplex, line 49, in unindexObject
Module Products.CMFPlone.CatalogTool, line 445, in uncatalog_object
Module Products.CacheSetup.patch, line 109, in uncatalog_object
Module Products.CacheSetup.patch_utils, line 6, in call
Module Products.ZCatalog.ZCatalog, line 569, in uncatalog_object
Module Products.ZCatalog.Catalog, line 390, in uncatalogObject
Module Products.PluginIndexes.DateRangeIndex.DateRangeIndex, line 192, in unindex_object
Module Products.PluginIndexes.DateRangeIndex.DateRangeIndex, line 391, in _removeForwardIndexEntry
KeyError: -1666126693
In some cases other operations also triggers the same errors.
The parent folder in which this is happening was recently cut and pasted to its current location in the site, maybe that's got something to do with it.
Help much appreciated, thanks !

Try to rebuild the catalog, it can help, it seems there are some orphan objects in the catalog.

Related

debugging ZEXP import - no module named

I am attempting to zexp import a site from what should have been the same Plone version and addon packages. However, when I do so I get
Module ZPublisher.Publish, line 60, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module OFS.ObjectManager, line 620, in manage_importObject
Module OFS.ObjectManager, line 638, in _importObjectFromFile
Module ZODB.ExportImport, line 92, in importFile
Module transaction._transaction, line 260, in savepoint
Module transaction._transaction, line 257, in savepoint
Module transaction._transaction, line 690, in __init__
Module ZODB.Connection, line 1123, in savepoint
Module ZODB.Connection, line 587, in _commit
Module ZODB.ExportImport, line 176, in _importDuringCommit
ImportError: No module named MyOldPackage.Content
This is an old Archetypes class that has since been migrated to a replacement in Dexterity. I thought I had removed all references but apparently something got missed. I get that I have to remove all objects that use this class but there's the rub - how do I find which objects use them?
I thought I had found something in the CMFEditions tools but that might be a red herring. Trying to export portal_historiesstorage yields the same error so I thought perhaps some old versions of past content were stuck there. Deleted shadow storage and rebuilt it, so it's now blank (ZMI page confirms this). But I'm still getting the error when trying to import just this tool - how is it still trying to reference this class? This is why I think it might be a red herring and it's inheriting something from the portal object, but I'm having a rough time trying to find where this class is referenced.
edit:
It looks like I have something bad in zvc_repo - I'm not sure the difference in what shadow storage and this are supposed to do. Here's a proposed script. Can anyone with better CMFEditions or ZopeVersionControl comment on how this sounds?
tool = portal.portal_historiesstorage
from ZODB.broken import PersistentBroken
bad_repo_ids = set()
for sequence in tool.zvc_repo._histories:
for version in tool.zvc_repo[sequence]._versions:
obj = tool.zvc_repo[sequence].getVersionById(version)._data._object.object
if isinstance(obj, PersistentBroken):
bad_repo_ids.add(sequence)
for bid in bad_repo_ids:
del tool.zvc_repo._histories[bid]

login form, createTicket and UnicodeDecodeError bug and potential solution

I recently migrated a Plone site from Plone 4.1.4 to Plone 4.2.4. The migration itself reported no errors. However, in the last couple of days we have received reports of very strange behavior. Certain users could not log in and received a UnicodeDecodeError in plone.session.tktauth and the createTicket function (see below) and were sent back to the login form. None of these users had utf-8 characters in their username or password, which was the strangest part about all of this.
Upon some investigation, I saw that plone.session was version 3.5.2 and two lines had the encoding set to None. In my previous version 3.5, the encoding in createTicket and splitTicket was set to utf-8. By changing these lines to utf-8 I resolved the error (so far!):
def createTicket(secret, userid, tokens=(), user_data='', ip='0.0.0.0', timestamp=None, encoding='utf8', mod_auth_tkt=False):
...
def splitTicket(ticket, encoding='utf8'):
...
Not sure if anyone else has experienced this or if this is a bug, but I thought I would put it out there. Hope this helps anyone suffering from the same problem.
Best,
Patrick
Original Error:
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFFormController.FSControllerPageTemplate, line 91, in __call__
Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
Module Products.CMFFormController.ControllerBase, line 231, in getNext
Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFFormController.FSControllerPythonScript, line 105, in __call__
Module Products.CMFFormController.Script, line 145, in __call__
Module Products.CMFCore.FSPythonScript, line 127, in __call__
Module Shared.DC.Scripts.Bindings, line 322, in __call__
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 29, in logged_in
<FSControllerPythonScript at /Plone/logged_in>
Line 29
Module Products.PlonePAS.tools.membership, line 624, in loginUser
Module Products.PlonePAS.plugins.cookie_handler, line 93, in login
Module Products.PluggableAuthService.PluggableAuthService, line 1140, in updateCredentials
Module plone.session.plugins.session, line 220, in updateCredentials
Module plone.session.plugins.session, line 140, in _setupSession
Module plone.session.tktauth, line 177, in createTicket
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa8 in position 6: ordinal not in range(128)
There is already a discussion about this here: https://github.com/plone/plone.session/commit/0d4079c0e0ceff780ab10ce3206e99c59c4010a2#L1L200
Proposed solution, where encoding=None in plone.session.tktauth, set to utf8:
def createTicket(secret, userid, tokens=(), user_data='', ip='0.0.0.0', timestamp=None, encoding='utf8', mod_auth_tkt=False):
...
def splitTicket(ticket, encoding='utf8'):

plone.outputfilters.filters.resolveuid_and_caption: got an unexpected keyword argument 'quote'

I have started to see this on old 3.3.x instance:
'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x1153346c>}
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 163, in _eval
Module Products.PageTemplates.Expressions, line 125, in render
Module Products.Archetypes.ClassGen, line 56, in generatedAccessor
Module wicked.fieldevent, line 29, in render
Module zope.event, line 23, in notify
Module zope.component.event, line 26, in dispatch
Module zope.component._api, line 130, in subscribers
Module zope.component.registry, line 290, in subscribers
Module zope.interface.adapter, line 583, in subscribers
Module wicked.fieldevent, line 16, in notifyFieldEvent
Module zope.component._api, line 101, in getMultiAdapter
Module zope.component._api, line 114, in queryMultiAdapter
Module zope.component.registry, line 206, in queryMultiAdapter
Module zope.interface.adapter, line 530, in queryMultiAdapter
Module wicked.fieldevent.meta, line 78, in field_value
Module Products.Archetypes.Field, line 1394, in get
Module Products.Archetypes.BaseUnit, line 100, in transform
Module Products.PortalTransforms.TransformEngine, line 181, in convertTo
Module Products.PortalTransforms.chain, line 51, in convert
Module Products.PortalTransforms.Transform, line 192, in convert
Module plone.outputfilters.transforms.html_to_plone_outputfilters_html, line 47, in convert
Module plone.outputfilters, line 6, in apply_filters
Module plone.outputfilters.filters.resolveuid_and_caption, line 103, in __call__
Module sgmllib, line 95, in feed
Module sgmllib, line 129, in goahead
Module sgmllib, line 283, in parse_starttag
Module sgmllib, line 314, in finish_starttag
Module plone.outputfilters.filters.resolveuid_and_caption, line 349, in unknown_starttag
TypeError: <lambda>() got an unexpected keyword argument 'quote'
It apparently some kind of compatibility problem with Plone 3.3.x and plone.outputfilters which could be solved with proper pindowns. However I am not sure what components are involved and thus what's Known Good Set to fix this.
I'd like to get a temporary solution for this before getting all sites migrated, as old stuff should not just break down if you leave it unattended :(
Also the latest security fix might be involved.
I too have a few old 3.3.5 sites and just started seeing this error. Pinning plone.outputfilters to version 1.6 seems to fix it so far. I.e., in buildout.cfg
[versions]
...
plone.outputfilters = 1.6
I bet you are using TinyMCE, this pulls p.outputfilters.
As with the Plone-3-series the default editor is Kupu, this changement can be the cause and apparently has been fixed in the Plone-core: https://dev.plone.org/ticket/9938
Quoting David Glick:
"For historical reasons, these transformations are implemented in both kupu and TinyMCE. This has been a maintenance problem, as bugfixes for these features in one of the packages usually don't get ported to the other."
You'll have to apply a patch according to these changements, I suppose.
Also this changement could be relevant as this topic concerns both, the core and the third-party-editor code:
https://github.com/plone/plone.outputfilters/commit/e5067c8ef1894d1017d6bc81c5969112676840d5#plone/outputfilters/filters/resolveuid_and_caption.py
Using the current unreleased dev-branch of p.outputfilters (1.9 by time of writing) could help, too.

Plone custom template for content type

Iam new to Plone. I followed the link http://plone.org/documentation/kb/creating-a-content-type-for-plone-3-for-developers and i added dvd content type. When i extend it by using http://plone.org/documentation/kb/creating-a-custom-template-for-a-plone-content-type, custom template is not showing.Iam getting the error as
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.Five.browser.metaconfigure, line 476, in __call__
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 107, in pt_render
- Warning: Compilation failed
- Warning: zope.tal.taldefs.TALError: bad TAL attribute: u'', at line 27, column 4
PTRuntimeError: ['Compilation failed', "zope.tal.taldefs.TALError: bad TAL attribute: u'', at line 27, column 4"]
I know i made some mistake. I dont know whats that.Anyone help me?!...
If you look at the error :
Warning: zope.tal.taldefs.TALError: bad TAL attribute: u'', at line 27, column 4
It says that you have an attributes u'' that have nothing to do in a tal expression. Maybe something like
tal:attributes="u''"
somewhere in your template...

How do I enable the visual diff tool for a Dexterity content type?

I've enabled versioning for a Dexterity content type I'm developing. I'm currently using Plone 4.1 and Dexterity 1.0.1.
I've added the collective.dexteritydiff package and following the instructions on the site, I've added a Compound Diff for Dexterity for my content type using the portal_diff tool in ZMI.
The Compare and Compare to Current links are now showing in the History pane for my content type items however clicking on either produces the following stack trace:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFEditions.browser.diff, line 61, in __call__
Module Products.CMFDiffTool.CMFDiffTool, line 156, in createChangeSet
Module Products.CMFDiffTool.ChangeSet, line 80, in computeDiff
Module Products.CMFDiffTool.CMFDiffTool, line 142, in computeDiff
Module collective.dexteritydiff.compounddiff, line 37, in __init__
Module collective.dexteritydiff.compounddiff, line 60, in _diff
Module collective.dexteritydiff.compounddiff, line 74, in _diff_schema
Module collective.dexteritydiff.compounddiff, line 93, in _diff_field
Module Products.CMFDiffTool.BaseDiff, line 26, in __init__
Module Products.CMFDiffTool.BaseDiff, line 81, in _getValue
AttributeError: subjects
I've declared the class for my content type programmatically. Is there anything I need to add to my code to make the diff tool work?
This seems to be a known bug on collective.dexteritydiff; also, please note that release 1.0.1 of Dexterity a little bit buggy; please update to the latest one.

Resources