@@ -1605,31 +1605,34 @@ def load_server_extensions(self):
1605
1605
"loaded" .format (extension_name = extension .extension_name )
1606
1606
)
1607
1607
# Find the extension loading function.
1608
+ func = None
1608
1609
try :
1609
1610
# This function was prefixed with an underscore in in v1.0
1610
1611
# because this shouldn't be a public API for most extensions.
1611
1612
func = getattr (extension , '_load_jupyter_server_extension' )
1612
- func (self )
1613
- self .log .debug (log_msg )
1614
1613
except AttributeError :
1615
- # For backwards compatibility, we will still look for non
1616
- # underscored loading functions.
1617
- func = getattr (extension , 'load_jupyter_server_extension' )
1614
+ try :
1615
+ # For backwards compatibility, we will still look for non
1616
+ # underscored loading functions.
1617
+ func = getattr (extension , 'load_jupyter_server_extension' )
1618
+ warn_msg = _ (
1619
+ "{extkey} is enabled. "
1620
+ "`load_jupyter_server_extension` function "
1621
+ "was found but `_load_jupyter_server_extension`"
1622
+ "is preferred." .format (extkey = extkey )
1623
+ )
1624
+ self .log .warning (warn_msg )
1625
+ except AttributeError :
1626
+ warn_msg = _ (
1627
+ "{extkey} is enabled but no "
1628
+ "`_load_jupyter_server_extension` function "
1629
+ "was found." .format (extkey = extkey )
1630
+ )
1631
+ self .log .warning (warn_msg )
1632
+ if func :
1618
1633
func (self )
1619
- warn_msg = _ (
1620
- "{extkey} is enabled. "
1621
- "`load_jupyter_server_extension` function "
1622
- "was found but `_load_jupyter_server_extension`"
1623
- "is preferred." .format (extkey = extkey )
1624
- )
1625
- self .log .warning (warn_msg )
1626
- except AttributeError :
1627
- warn_msg = _ (
1628
- "{extkey} is enabled but no "
1629
- "`_load_jupyter_server_extension` function "
1630
- "was found." .format (extkey = extkey )
1631
- )
1632
- self .log .warning (warn_msg )
1634
+ self .log .debug (log_msg )
1635
+
1633
1636
1634
1637
def init_mime_overrides (self ):
1635
1638
# On some Windows machines, an application has registered incorrect
0 commit comments