jmcarp / nplusone

Auto-detecting the n+1 queries problem in Python
MIT License
1.01k stars 50 forks source link

Prevent AttributeError when listeners not present on Flask.g #35

Open alanhamlett opened 4 years ago

alanhamlett commented 4 years ago

When listeners not present on Flask.g (connect was unable to run) then accessing that attribute raises exception:

AttributeError: '_AppCtxGlobals' object has no attribute 'listeners'

Checking that listeners exists first fixes the bug.