plone / plone.app.registry

provides Plone UI, persistence and GenericSetup integration for plone.registry
https://pypi.org/project/plone.app.registry
2 stars 6 forks source link

Error with disabled rightcolumn #71

Closed 1letter closed 1 year ago

1letter commented 1 year ago

I have disable the right column for portlets via policy

<portletmanager
    name="plone.rightcolumn"
    remove="True"
    type="plone.app.portlets.interfaces.IRightColumn"
  />

if i called the "portal_registry", a error happens with the following traceback

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 390, in publish_module
  Module ZPublisher.WSGIPublisher, line 285, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 68, in call_object
  Module plone.app.registry.browser.records, line 233, in __call__
  Module z3c.form.form, line 239, in __call__
  Module z3c.form.form, line 163, in render
  Module Products.Five.browser.pagetemplatefile, line 126, in __call__
  Module Products.Five.browser.pagetemplatefile, line 58, in __call__
  Module zope.pagetemplate.pagetemplate, line 134, in pt_render
  Module Products.PageTemplates.engine, line 365, in __call__
  Module z3c.pt.pagetemplate, line 174, in render
  Module chameleon.zpt.template, line 298, in render
  Module chameleon.template, line 214, in render
  Module chameleon.utils, line 20, in raise_with_traceback
  Module chameleon.template, line 190, in render
  Module 5e679323f39770ed9c87e78ee5aaf32f, line 1470, in render
  Module ff6c9006592e0093e1b75ece552614d2, line 913, in render_master
  Module ae4306964438b0fd08473b8f8fd56b33, line 1023, in render_master
  Module zope.contentprovider.tales, line 65, in __call__
zope.contentprovider.interfaces.ContentProviderLookupError: zope.contentprovider.interfaces.ContentProviderLookupError: plone.rightcolumn

 - Expression: "provider:plone.rightcolumn"
 - Filename:   ... ges/Products/CMFPlone/browser/templates/main_template.pt
 - Location:   (line 140: col 38)
 - Source:     ... replace="structure provider:plone.rightcolumn" />
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Expression: "context/@@main_template/macros/master"
 - Filename:   ... ducts/CMFPlone/controlpanel/browser/prefsmaintemplate.pt
 - Location:   (line 2: col 30)
 - Source:     ... tal:use-macro="context/@@main_template/macros/master">
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Expression: "context/@@prefs_main_template/macros/master"
 - Filename:   ... verrides/plone.app.registry.browser.templates.records.pt
 - Location:   (line 6: col 23)
 - Source:     ... :use-macro="context/@@prefs_main_template/macros/master"
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - Arguments:  template: <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x7ff6c056d630>
               options: {}
               args: ()
               nothing: None
               modules: <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter object at 0x7ff6ca445570>
               request: <WSGIRequest, URL=http://localhost:8080/nct/portal_registry/@@configuration_registry>
               view: <Products.Five.browser.metaconfigure.RecordsControlPanel object at 0x7ff6c2bf0f10>
               context: <plone.app.registry.registry.Registry object at 0x7ff6c41100b0 oid 0x9822b in <Connection at 7ff6c754c310>>
               views: <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7ff6c056d7e0>
               here: <plone.app.registry.registry.Registry object at 0x7ff6c41100b0 oid 0x9822b in <Connection at 7ff6c754c310>>
               container: <plone.app.registry.registry.Registry object at 0x7ff6c41100b0 oid 0x9822b in <Connection at 7ff6c754c310>>
               root: <Application at >
               traverse_subpath: []
               user: <PropertiedUser 'admin'>
               default: <DEFAULT>
               repeat: <Products.PageTemplates.engine.RepeatDictWrapper object at 0x7ff6c2105ac0>
               loop: {'group': <Products.PageTemplates.engine.RepeatItem object at 0x7ff6c04d2fe0>, 'configlet': <Products.PageTemplates.engine.RepeatItem object at 0x7ff6c04f93c0>, 'prefix': <Products.PageTemplates.engine.RepeatItem object at 0x7ff6c04f9e10>, 'record': <Products.PageTemplates.engine.RepeatItem object at 0x7ff6c04fa050>, 'widget': <Products.PageTemplates.engine.RepeatItem object at 0x7ff6c02a9570>, 'action': <Products.PageTemplates.engine.RepeatItem object at 0x7ff6c02a9900>}
               target_language: None
               translate: <function BaseTemplate.render.<locals>.translate at 0x7ff6c05731c0>
               macroname: 'master'
               attrs: {}

Update: Solution: customize records.pt, and disable the column rendering in the template

<tal:defines
  tal:define="
    dummy python:request.set('disable_border', 1);
    disable_column_one python:request.set('disable_plone.leftcolumn', 1);
    disable_column_two python:request.set('disable_plone.rightcolumn', 1);"/>
mauritsvanrees commented 1 year ago

I would be in favour of this change. I see no reason why we would need to show the right portlet column. I suspect this was a typo or bad copy-paste, and the line was always meant to hide column two instead of explicitly showing it. This line has been there since the file was first introduced in 2016.

Alternative would be to remove the line: then the second column only gets shown when there actually is a portlet in that column.

But disabling it seems best. Anyone against? @1letter can you make a PR?

1letter commented 1 year ago

@mauritsvanrees yes i can ;-)

1letter commented 1 year ago

@mauritsvanrees done and green: https://github.com/plone/plone.app.registry/pull/78

mauritsvanrees commented 1 year ago

Fixed with PR #78.