File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1+ # pylint: disable=too-few-public-methods
2+ from .exceptions import ObsoleteAttributeException
3+
4+
5+ class ObsoleteAttribute :
6+ def __init__ (self , message : str , exc = ObsoleteAttributeException ):
7+ self .message = message
8+ self .exc = exc
9+
10+
11+ class ObsoleteChecker :
12+ _obsolete_attributes = {
13+ "run_server" : ObsoleteAttribute ("app.run_server has been replaced by app.run" ),
14+ "long_callback" : ObsoleteAttribute (
15+ "app.long_callback has been removed, use app.callback(..., background=True) instead"
16+ ),
17+ }
18+
19+ def __getattr__ (self , name : str ):
20+ if name in self ._obsolete_attributes :
21+ err = self ._obsolete_attributes [name ]
22+ raise err .exc (err .message )
23+ return getattr (self , name )
Original file line number Diff line number Diff line change 6666from . import _get_app
6767
6868from ._grouping import map_grouping , grouping_len , update_args_group
69+ from ._obsolete import ObsoleteChecker
6970
7071from . import _pages
7172from ._pages import (
@@ -194,7 +195,7 @@ def _do_skip(error):
194195
195196# pylint: disable=too-many-instance-attributes
196197# pylint: disable=too-many-arguments, too-many-locals
197- class Dash :
198+ class Dash ( ObsoleteChecker ) :
198199 """Dash is a framework for building analytical web applications.
199200 No JavaScript required.
200201
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ class ObsoleteKwargException(DashException):
1010 pass
1111
1212
13+ class ObsoleteAttributeException (DashException ):
14+ pass
15+
16+
1317class NoLayoutException (DashException ):
1418 pass
1519
You can’t perform that action at this time.
0 commit comments