question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SHOW_TOOLBAR_CALLBACK no longer supports lambda

See original GitHub issue

in my setup i always have seperate dev settings and in those settings i enable debug toolbar for all requests. i’ve always done that with the following config

DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK': lambda request: True,
}

after updating my virtualenv this morning i started getting errors that i’ve tracked down to trying to run rsplit on func_path

line 45 of debu_toolbar/middleware.py:

    mod_path, func_name = func_path.rsplit('.', 1)

it looks like the meaning of SHOW_TOOLBAR_CALLBACK may have changed to require a string and not support a callable. if that’s the case i’m not sure what the solution would be. i’d rather not have to define a function somewhere and point this at it just to return true. i’d prefer if SHOW_TOOLBAR_CALLBACK supported being presented a callable.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
aaugustincommented, Jan 8, 2014

All Django settings have primitive values, to avoid the temptation to import stuff in settings. The Debug Toolbar follows this philosophy. I’m sorry that it makes your use case marginally less practical, but I still think it’s a good trade-off for the community at large.

I would suggest the following (untested) code:

DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK': "%s.true" % __name__,
}

def true(request):
    return True
3reactions
dcramercommented, Nov 1, 2014

I dont think developers being ignorant is a good reason to remove simplicity 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Creating a simple Lambda@Edge function
This tutorial shows you how to get started with Lambda@Edge by helping you create and add a sample Node.js function that runs in...
Read more >
How to do callback in kivymd toolbar from the screen manager?
I've found working solution. Maybe it will be helpful for someone: /main.py class App(MDApp): kv_file = 'main.kv' if __name__ == '__main__': ...
Read more >
Lambda Integration - AWS Workshop Studio
Click Build on the top right-hand corner so Amazon Lex registers the lambda function. Test the bot by clicking the right hand side...
Read more >
Provide custom back navigation - Android Developers
To learn more about this upcoming feature, see the corresponding preview ... The callback can be enabled or disabled here or in the...
Read more >
Configuration — Django Debug Toolbar 3.8.1 documentation
This is the dotted path to a function used for determining whether the toolbar should show or not. The default checks are that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found