##// END OF EJS Templates
http-app: use filter predicate to filter out bad backends submitted into the app.
marcink -
r152:1a982f31 default
parent child Browse files
Show More
@@ -199,7 +199,8 b' class HTTPApplication(object):'
199 self.config.add_view(self.hg_proxy(), route_name='hg_proxy')
199 self.config.add_view(self.hg_proxy(), route_name='hg_proxy')
200 self.config.add_view(self.git_proxy(), route_name='git_proxy')
200 self.config.add_view(self.git_proxy(), route_name='git_proxy')
201 self.config.add_view(
201 self.config.add_view(
202 self.vcs_view, route_name='vcs', renderer='msgpack')
202 self.vcs_view, route_name='vcs', renderer='msgpack',
203 custom_predicates=[self.is_vcs_view])
203
204
204 self.config.add_view(self.hg_stream(), route_name='stream_hg')
205 self.config.add_view(self.hg_stream(), route_name='stream_hg')
205 self.config.add_view(self.git_stream(), route_name='stream_git')
206 self.config.add_view(self.git_stream(), route_name='stream_git')
@@ -215,7 +216,6 b' class HTTPApplication(object):'
215 self.config.add_view(
216 self.config.add_view(
216 self.general_error_handler, context=Exception)
217 self.general_error_handler, context=Exception)
217
218
218
219 def wsgi_app(self):
219 def wsgi_app(self):
220 return self.config.make_wsgi_app()
220 return self.config.make_wsgi_app()
221
221
@@ -351,6 +351,14 b' class HTTPApplication(object):'
351 return app(environ, start_response)
351 return app(environ, start_response)
352 return _git_stream
352 return _git_stream
353
353
354 def is_vcs_view(self, context, request):
355 """
356 View predicate that returns true if given backend is supported by
357 defined remotes.
358 """
359 backend = request.matchdict.get('backend')
360 return backend in self._remotes
361
354 def is_vcs_exception(self, context, request):
362 def is_vcs_exception(self, context, request):
355 """
363 """
356 View predicate that returns true if the context object is a VCS
364 View predicate that returns true if the context object is a VCS
General Comments 0
You need to be logged in to leave comments. Login now