You don't show the @panel_config but assuming it's within the boundaries of one 
of your calls to config.scan() then the issue is that pyramid's "scan" function 
by default scans for "pyramid" decorators and pyramid_layout registers its 
decorators under the "pyramid_layout" category. This means you should adjust 
your scan for panels to include that category:

    config.scan("myapp.panels", categories=("pyramid", "pyramid_layout"))

See 
https://github.com/Pylons/pyramid_layout/blob/202a291bbb947e7f5c43c5216878331987508f05/pyramid_layout/panel.py#L36
 and 
https://docs.pylonsproject.org/projects/pyramid/en/latest/api/config.html#pyramid.config.Configurator.scan.


> On Sep 13, 2025, at 10:56, 'Antony Owino' via pylons-discuss 
> <[email protected]> wrote:
> 
> Hello,
> 
> Struggling get to panels executed, i.e. Pyramid renders None instead of panel 
> content. I have the following code in myapp/__init__.py
> 
> @event_source
> def configure_panels(config):
>     config.include("pyramid_layout")
> 
> @event_source
> def configure_views(config):    
>     ...
> 
>     # adds cornice
>     config.include("cornice")
> 
>     # adds panels
>     config.include("pyramid_layout")
>     from . import panels
>     config.include("myapp.panels.dashboard")
>     config.scan(panels)
> 
>     from . import views
>     config.scan(views)
> 
> 
> def main(global_config, **settings):
>     """This function returns a Pyramid WSGI application."""
>     with Configurator(settings=settings) as config:
>         # Core view and layout related
>         ...
>         configure_views(config)
>         configure_panels(config)
>         ...
> 
> Which is supposed to load views and panels but the panels are not executed. 
> 
> What works is manually adding a panel in myapp/panels/dashboard/__init__.py 
> i.e.:
> 
> def includeme(config):
>     """Configure dashboard panels."""
>     config.include("pyramid_layout")
> 
>     # !!! This does not work
>     # I have an empty __init__.py in the panels/dashboard module
>     config.scan("myapp.panels.dashboard")
> 
>     # Manual panel addition (only this works)
>     config.add_panel(
>         "myapp.panels.dashboard.dashboard.test_panel",
>         name="test_panel",
>         renderer="string",
>     )
> 
> I'd really prefer adding the panels declaratively. Thank you all in advance.
> 
> __ntny__
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion visit 
> https://groups.google.com/d/msgid/pylons-discuss/e1327a42-0360-4182-9b6c-aed2ee6b7139n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/pylons-discuss/e1327a42-0360-4182-9b6c-aed2ee6b7139n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/pylons-discuss/E3F504D3-54EF-4F4B-B754-B6AA609B44CC%40gmail.com.

Reply via email to