Open damjankuznar opened 11 years ago
Thats odd, they do for me. We mount many apps in our project at https://github.com/nicholasdavidson/pybit, and use a hook decorator for HTTP auth. We are using version from debian squeeze.
Could this be because I'm using version 0.11.6 (stable)? Which version do you use? I will do some more testing and report back. And thanks for the reply.
On Sun, Jul 14, 2013 at 9:58 PM, James Bennet notifications@github.comwrote:
Thats odd, they do for me. We mount many apps in our project at https://github.com/nicholasdavidson/pybit, and use a hook decorator for HTTP auth.
— Reply to this email directly or view it on GitHubhttps://github.com/defnull/bottle/issues/524#issuecomment-20942615 .
I've encountered the same issue for 0.11.6. Workaround is to add global hook to every merged application.
However it would be nice for API to work that way:
from views.admin import admin_app
admin_app.hooks.add('before_request', login_required)
app.merge(admin_app)
app.hooks.add('before_request', global_hook)
I am having the same issue when splitting up my application into multiple folders. In 0.13-dev, you should use
app.add_hook('before_request', hook_function)
I have a master app and several sub-apps that are merged into the master app using the
Bottle.merge()
method. While the routes work as expected, the hooksbefore_request
andafter_request
(using the defaultHooksPlugin
that is initialized inBottle.__init__()
) do not fire if the route is handled by a different app. For me, such behaviour is unwanted and I would expect that hooks get fired regardless of the handling app. Therefore, I would propose, that themerge()
method would also merge hooks.