File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 44from . import EXTENSION_NAME
55
66
7- def current_labthing ():
7+ def current_labthing (app = None ):
88 """The LabThing instance handling current requests.
99
1010 Searches for a valid LabThing extension attached to the current Flask context.
1111 """
1212 # We use _get_current_object so that Task threads can still
1313 # reach the Flask app object. Just using current_app returns
1414 # a wrapper, which breaks it's use in Task threads
15- app = current_app ._get_current_object () # skipcq: PYL-W0212
15+ if not app :
16+ app = current_app ._get_current_object () # skipcq: PYL-W0212
1617 if not app :
1718 return None
1819 logging .debug ("Active app extensions:" )
1920 logging .debug (app .extensions )
2021 logging .debug ("Active labthing:" )
2122 logging .debug (app .extensions [EXTENSION_NAME ])
22- return app .extensions [ EXTENSION_NAME ]
23+ return app .extensions . get ( EXTENSION_NAME , None )
2324
2425
2526def registered_extensions (labthing_instance = None ):
You can’t perform that action at this time.
0 commit comments