Skip to content

Commit 64fe81d

Browse files
author
Mark Gibbs
committed
Rename wrappers for Flask and Dash
1 parent c95ab01 commit 64fe81d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

django_plotly_dash/dash_wrapper.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ def form_dash_instance(self, replacements=None, specific_identifier=None, stub=N
9494

9595
ndid, base_pathname = self.get_base_pathname(specific_identifier, stub)
9696

97-
rd = NotDash(base_pathname=base_pathname,
98-
expanded_callbacks = self._expanded_callbacks,
99-
replacements = replacements,
100-
ndid = ndid)
97+
rd = WrappedDash(base_pathname=base_pathname,
98+
expanded_callbacks = self._expanded_callbacks,
99+
replacements = replacements,
100+
ndid = ndid)
101101

102102
rd.layout = self.layout
103103

@@ -124,7 +124,7 @@ def expanded_callback(self, output, inputs=[], state=[], events=[]):
124124
self._expanded_callbacks = True
125125
return self.callback(output, inputs, state, events)
126126

127-
class NotFlask:
127+
class PseudoFlask:
128128
def __init__(self):
129129
self.config = {}
130130
self.endpoints = {}
@@ -141,19 +141,19 @@ def before_first_request(self,*args,**kwargs):
141141
def run(self,*args,**kwargs):
142142
pass
143143

144-
class NotDash(Dash):
144+
class WrappedDash(Dash):
145145
def __init__(self, base_pathname=None, replacements = None, ndid=None, expanded_callbacks=False, **kwargs):
146146

147147
self._uid = ndid
148148

149149
self._flask_app = Flask(self._uid)
150-
self._notflask = NotFlask()
150+
self._notflask = PseudoFlask()
151151
self._base_pathname = base_pathname
152152

153153
kwargs['url_base_pathname'] = self._base_pathname
154154
kwargs['server'] = self._notflask
155155

156-
super(NotDash, self).__init__(**kwargs)
156+
super(WrappedDash, self).__init__(**kwargs)
157157

158158
self.css.config.serve_locally = True
159159
self.css.config.serve_locally = False
@@ -276,10 +276,10 @@ def _fix_callback_item(self, item):
276276
return item
277277

278278
def callback(self, output, inputs=[], state=[], events=[]):
279-
return super(NotDash, self).callback(self._fix_callback_item(output),
280-
[self._fix_callback_item(x) for x in inputs],
281-
[self._fix_callback_item(x) for x in state],
282-
[self._fix_callback_item(x) for x in events])
279+
return super(WrappedDash, self).callback(self._fix_callback_item(output),
280+
[self._fix_callback_item(x) for x in inputs],
281+
[self._fix_callback_item(x) for x in state],
282+
[self._fix_callback_item(x) for x in events])
283283

284284
def dispatch(self):
285285
import flask

0 commit comments

Comments
 (0)