Plone catalog rebuild: AttributeError portal_setup - plone

Since a few days, I get following Error, if I rebuild the portal_catalog
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.CMFPlone.CatalogTool, line 446, in manage_catalogRebuild
Module plone.app.discussion.patches, line 47, in patchedClearFindAndRebuild
Module OFS.FindSupport, line 239, in ZopeFindAndApply
Module OFS.FindSupport, line 198, in ZopeFindAndApply
Module Products.ZCatalog.Lazy, line 190, in __getitem__
Module plone.folder.ordered, line 94, in <lambda>
Module plone.folder.ordered, line 59, in _getOb
AttributeError: 'portal_setup'
Has anyone an Idea, what could be wrong?
Plone 4.3.4

The old language root folder implementation left garbage ids in the IOrdering of the folder. This needs a manual cleanup. An example here https://gist.github.com/jensens/356ab35614c4c0a7c626d8ba4a7a8479 - you may need to append values to the blacklist, depending on language and addons installed.

Related

Can't create Dexterity content type programatically in Plone 4.3.1

I created a new content type using the Dexterity manager in Site Setup. I'm able to successfully add content through the Plone user interface, but I've come to a point where I need to create the same object with a python script.
My first attempt was with invokeFactory:
context.invokeFactory("mycontenttype", id="test", Title="Test")
This same code works for "Folder" objects, but fails with my Dexterity type:
Traceback (innermost last):
Module ZPublisher.Publish, line 60, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in __call__
Module Products.PloneHotfix20130618.spamProtect, line 35, in _patched_bindAndExec
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 7, in test
- <PythonScript at /three-year-plan/test>
- Line 7
TypeError: invokeFactory() takes at least 3 arguments (2 given)
After doing some more searching, I found several places referring to the following function:
from plone.dexterity.utils import createContentInContainer
Any attempt to import from plone.dexterity.utils in my python scripts ends up with a permissions error:
Traceback (innermost last):
Module ZPublisher.Publish, line 60, in publish
Module ZPublisher.mapply, line 77, in mapply
zModule ZPublisher.Publish, line 46, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in __call__
Module Products.PloneHotfix20130618.spamProtect, line 35, in _patched_bindAndExec
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 1, in test
- <PythonScript at /my-site/test>
- Line 1
Module AccessControl.ZopeGuards, line 305, in guarded_import
Unauthorized: import of 'plone.dexterity.utils' is unauthorized
Any help in resolving the errors above or alternative methods would be greatly appreciated. Version details are posted below for reference.
Version Overview
Plone 4.3.1 (4306)
CMF 2.2.7
Zope 2.13.19
Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3]
PIL 1.7.8 (Pillow)
Dexterity Content Types 2.0.8
You should be able to use "invokeFactory" for this purpose. You call it on the container and pass it the type name as a string.
I'm not sure where your attempt to use the invokeFactory method went awry, but it does work. See http://developer.plone.org/reference_manuals/external/plone.app.dexterity/reference/manipulating-content-objects.html?highlight=invokefactory#adding-an-object-to-a-container for details.
Your guess is right: you have to use createContentInContainer.
But you cannot use it in a Python script because only the so called restricted Python is allowed [1]. Put it in a view [2].
As a reference have a look to:
http://developer.plone.org/reference_manuals/active/helloworld/extend/view.html
http://plone.org/documentation/faq/restricted-python-scripts

Plone 4.0.7 - Maximum recursion depth error when checking in large PDF

Recently one of our site users successfully checked out a large PDF and was trying to check it back in but it failed with the following stack trace:
2013-02-21 12:42:39 ERROR Zope.SiteErrorLog 1361450559.20.0921547927966
http://phoebe:8095/portal/our-responsibilities/codes-of-conduct/copy_of_please-let-us-
know-where-you-live/content_status_modify
Traceback (innermost last):
Module ZPublisher.Publish, line 127, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 47, in call_object
Module Products.CMFFormController.FSControllerPythonScript, line 105, in __call__
Module Products.CMFFormController.Script, line 145, in __call__
Module Products.CMFCore.FSPythonScript, line 130, in __call__
Module Shared.DC.Scripts.Bindings, line 324, in __call__
Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 42, in content_status_modify
- <FSControllerPythonScript at /portal/our-responsibilities/codes-of-conduct/please-
let-us-know-where-you-live/content_status_modify>
- Line 42
Module Products.CMFCore.WorkflowTool, line 244, in doActionFor
Module Products.CMFCore.WorkflowTool, line 555, in _invokeWithNotification
Module Products.DCWorkflow.DCWorkflow, line 282, in doActionFor
Module Products.DCWorkflow.DCWorkflow, line 421, in _changeStateOf
Module Products.DCWorkflow.DCWorkflow, line 465, in _executeTransition
Module zope.event, line 23, in notify
Module zope.component.event, line 26, in dispatch
Module zope.component._api, line 138, in subscribers
Module zope.component.registry, line 323, in subscribers
Module zope.interface.adapter, line 575, in subscribers
Module zope.component.event, line 34, in objectEventNotify
Module zope.component._api, line 138, in subscribers
Module zope.component.registry, line 323, in subscribers
Module zope.interface.adapter, line 575, in subscribers
Module arcadia.app.events, line 22, in before_transition
Module plone.app.iterate.browser.checkin, line 50, in __call__
Module plone.app.iterate.policy, line 90, in checkin
Module zope.event, line 23, in notify
Module zope.component.event, line 26, in dispatch
Module zope.component._api, line 138, in subscribers
Module zope.component.registry, line 323, in subscribers
Module zope.interface.adapter, line 575, in subscribers
Module plone.app.iterate.subscribers.versioning, line 36, in handleAfterCheckin
Module plone.app.iterate.archiver, line 43, in save
Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 297, in save
Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 443, in
_recursiveSave
Module Products.CMFEditions.ArchivistTool, line 267, in prepare
Module Products.CMFEditions.ArchivistTool, line 221, in _cloneByPickle
Module ZODB.Connection, line 843, in setstate
Module logging, line 1047, in error
Module logging, line 1128, in _log
Module logging, line 1108, in makeRecord
Module logging, line 243, in __init__
RuntimeError: maximum recursion depth exceeded while calling a Python object
Has anyone else experienced this issue?
The PDF in question is 24MB in size, checking in a PDF reduced down to 9MB didn't cause the problem.
A simple solution is to keep the size of the PDFs down, but the user is adament they wan the larger version (higher resolution for printing).
Does anyone know:
Whether there is a fix for thi issue?
What the maximum size of a BLOB that can be checked in is?
Thanks
Tony
You may want to visit /portal_modifier/SkipVersioningOfLargeFilesAndImages/modifierEditForm in your site, and enable this modifier. This will disable versioning for the uploaded file payload for files larger than the threshold specified, but enable versioning for any edited metadata.

Plone 4.2.5: Disallowed to paste item(s)

Today I upgrade plone from 4.1.4 to latest 4.2.5 through buildout. Everthing works except paste. When I paste a page to a folder, traceback shows:
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.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 33, in folder_paste
- <FSControllerPythonScript at /keti/folder_paste used for /keti/switch1>
- Line 33
Exception: Disallowed to paste item(s).
I need your help.
Usually this error is thrown, if the 'allowed content types to add' are restricted, so I doubt a correlation of your problem with the upgrade and rather suspect a simple configuration-setting as the cause:
Go to
http://yourhost.org:8888/yourSiteId/portal_types/Folder/manage_propertiesForm
Look, if 'Filter content types' is checked.
If yes, either uncheck or define the allowed types in the widget below.
Ida Ebkes did get the point. So I unchecked 'Filter content types' and select file, document, folder in the widget below in portal_types/Plone%20Site/manage_propertiesForm . But it works for frontpage. So If I want "Add new" appear global, I have to check "Implicitly addable" in every content type page under portal_types.
Thanks,
Hugo

Aliases tab in portal_types tool in ZMI

I was trying to debug an unrelated issue with my site when I noticed the Aliases tab in the portal_types tool in the ZMI. I get no response if I try to access it in my Plone 4.1.5 site which uses dexterity. The following error is logged:
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 Shared.DC.Scripts.Bindings, line 322, in __call__
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.PageTemplates.PageTemplateFile, line 130, in _exec
Module Products.PageTemplates.PageTemplate, line 79, in pt_render
Module zope.pagetemplate.pagetemplate, line 126, in pt_render
- Warning: Compilation failed
- Warning: exceptions.SyntaxError: invalid syntax (4c47ca874ec06dbf9207ed3a51ff9bb29425ee06.py, line 4)
PTRuntimeError: ['Compilation failed', 'exceptions.SyntaxError: invalid syntax (4c47ca874ec06dbf9207ed3a51ff9bb29425ee06.py, line 4)']
It is working for a separate Plone 3.3.6 site I look after.
Is this view still supported in Plone 4.1?
As vangeem says this is a Chameleon issue
https://github.com/malthe/chameleon/issues/114

Cannot change the Type Settings in Site Setup

I am trying to change the Type Settings in Site Setup. The default is Simple Publication Workflow. When I tried to change it to Intranet Workflow or Community Workflow or any other workflow, I got this error:
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 plone.app.controlpanel.types, line 165, in __call__
Module zope.event, line 23, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 583, in subscribers
Module plone.app.discussion.browser.controlpanel, line 181, in notify_configuration_changed
AttributeError: 'NoneType' object has no attribute 'forInterface'
Can anybody advise?
We are using plone 4.1
Thank you very much.
Cmgui

Resources