Skip to content

Commit e6b3a56

Browse files
committed
Uninstall default bottle plugins
By default, bottle installs two plugins: `JSONPlugin` and `TemplatePlugin`. `TemplatePlugin` is always a no-op, because none of the routes we use (like `/ready`) have a template parameter. `JSONPlugin` could have been useful were it actually serializing all json messages. Instead it only deals with dictionaries. Ycmd has always had `ycmd.handlers._JsonResponse` and we will need to keep it that way. `_JsonResponse` makes `JSONPlugin` a no-op too, because, by the time we get to the `JSONPlugin.apply()` the response is always a str already. `Bottle.uninstall()` can be passed: 1. An instance of an installed plugins, to uninstall that one plugin. 2. A type, to uninstall all plugins of that type. 3. `True`, to uninstall all plugins. Since we are uninstalling all default plugins, we can just do `handlers.app.uninstall( True )` and then install the plugins we care about - `ycmd.HmacPlugin` and `ycmd.WatchdogPlugin`.
1 parent b8957d7 commit e6b3a56

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ycmd/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def Main():
203203
args.stderr,
204204
args.keep_logfiles )
205205
atexit.register( handlers.ServerCleanup )
206+
handlers.app.uninstall( True )
206207
handlers.app.install( WatchdogPlugin( args.idle_suicide_seconds,
207208
args.check_interval_seconds ) )
208209
handlers.app.install( HmacPlugin( hmac_secret ) )

0 commit comments

Comments
 (0)