`add_request_method` doesn't seem to work within an `includeme` anymore

9 views
Skip to first unread message

Jonathan Vanasco

unread,
Sep 20, 2023, 5:46:46 PM9/20/23
to pylons-discuss
This is driving me a bit crazy.  I hope someone can see the issue or changelog I am missing in the current pyramid and debugtoolbar.

I am adding some typing and tests to a debug toolbar that has the following in the includeme:

```
    def includeme(config: "Configurator"):
        config.add_debugtoolbar_panel(DogpileDebugPanel)
        config.add_request_method(
            "pyramid_debugtoolbar_dogpile.setup_dogpile_logging",
            "dogpile_logging",
            reify=True,
        )
```

Through debugging, i see the includeme is run and the debugtoolbar panel is enabled when using the following:

    with Configurator() as config:
        config.add_settings({"debugtoolbar.includes": ["pyramid_debugtoolbar_dogpile"]})
        config.include("pyramid_debugtoolbar")
        ...
        app = config.make_wsgi_app()
    serve(app, host='0.0.0.0', port=6543)

or

    def setUp(self):
        self.config = config = testing.setUp()
        config.add_settings({"debugtoolbar.includes": ["pyramid_debugtoolbar_dogpile"]})
        config.include("pyramid_debugtoolbar")

The request method, however, is not added.  No request methods I add within the includeme persist.

Adding the request method in the main application (copy paste that same snippet) will work.

Can anyone help set me on the right path ?





Jonathan Vanasco

unread,
Sep 20, 2023, 6:43:35 PM9/20/23
to pylons-discuss
I just remembered the debugtoolbar works as a separate application, which explains why I'm seeing different values for `id(config)`  in the toolbar and main app during setup.  unless I am crazy, this should never have worked.
Reply all
Reply to author
Forward
0 new messages