Skip to content

Commit bf734e7

Browse files
committed
rename get_pipeline -> get_pipeline_views
Also adds a method specifically for this
1 parent 0158848 commit bf734e7

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/sentry/utils/pipeline.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class PipelineProvider(object):
1212
views that the Pipeline will traverse through.
1313
"""
1414

15-
def get_pipeline(self):
15+
def get_pipeline_views(self):
1616
"""
1717
Returns a list of instantiated views which implement the PipelineView
18-
class. Each view will be dispatched in order.
18+
interface. Each view will be dispatched in order.
1919
>>> return [OAuthInitView(), OAuthCallbackView()]
2020
"""
2121
raise NotImplementedError
@@ -32,7 +32,7 @@ def set_config(self, config):
3232
class PipelineView(BaseView):
3333
"""
3434
A class implementing the PipelineView may be used in a PipleineProviders
35-
get_pipeline list.
35+
get_pipeline_views list.
3636
"""
3737

3838
def dispatch(self, request, pipeline):
@@ -144,14 +144,24 @@ def __init__(self, request, organization, provider_key, provider_model=None, con
144144
self.config = config
145145
self.provider.set_config(config)
146146

147-
self.pipeline = self.provider.get_pipeline()
147+
self.pipeline = self.get_pipeline_views()
148148

149149
# we serialize the pipeline to be ['fqn.PipelineView', ...] which
150150
# allows us to determine if the pipeline has changed during the auth
151151
# flow or if the user is somehow circumventing a chunk of it
152152
pipe_ids = ['{}.{}'.format(type(v).__module__, type(v).__name__) for v in self.pipeline]
153153
self.signature = md5_text(*pipe_ids).hexdigest()
154154

155+
def get_pipeline_views(self):
156+
"""
157+
Retrieve the pipeline views from the provider.
158+
159+
You may wish to override this method to provide views that all
160+
providers should inherit, or customize the provider method called to
161+
retrieve the views.
162+
"""
163+
return self.provider.get_pipeline_views()
164+
155165
def is_valid(self):
156166
return self.state.is_valid() and self.state.signature == self.signature
157167

tests/sentry/utils/test_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DummyProvider(PipelineProvider):
1616
key = 'dummy'
1717
pipeline = [PipelineStep(), PipelineStep()]
1818

19-
def get_pipeline(self):
19+
def get_pipeline_views(self):
2020
return self.pipeline
2121

2222

0 commit comments

Comments
 (0)