summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2011-04-23 18:03:57 +0200
committerMarcel Hellkamp <marc@gsites.de>2011-04-23 18:03:57 +0200
commitfd4f4d8c1184023c6fb3506976ce14b90dc118fa (patch)
tree266c6c32cdec4e1d3b31c64eaa3463318cbfa44a
parent7faa782d6e6dea2abffbdd2f93db54c88bb8e6dd (diff)
downloadbottle-fd4f4d8c1184023c6fb3506976ce14b90dc118fa.tar.gz
fix: Plugins are now disabled for sub application. See #149
-rwxr-xr-xbottle.py1
-rw-r--r--test/test_mount.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/bottle.py b/bottle.py
index c61477c..d17dc9a 100755
--- a/bottle.py
+++ b/bottle.py
@@ -434,6 +434,7 @@ class Bottle(object):
raise TypeError('Conflict with existing mount: %s' % other)
path_depth = prefix.count('/') + 1
options.setdefault('method', 'ANY')
+ options.setdefault('skip', True)
self.mounts[prefix] = app
@self.route('/%s/:#.*#' % prefix, **options)
def mountpoint():
diff --git a/test/test_mount.py b/test/test_mount.py
new file mode 100644
index 0000000..13af7a6
--- /dev/null
+++ b/test/test_mount.py
@@ -0,0 +1,28 @@
+import unittest
+import sys, os.path
+import bottle
+import urllib2
+from StringIO import StringIO
+import thread
+import time
+from tools import ServerTestBase
+from bottle import tob, touni, tonat, Bottle
+
+class TestWsgi(ServerTestBase):
+ ''' Tests sub-application support. '''
+
+ def test_mount_no_plugins(self):
+ def plugin(func):
+ def wrapper(*a, **ka):
+ return 'Plugin'
+ return wrapper
+ self.app.install(plugin)
+ app = Bottle()
+ self.app.mount(app, '/prefix')
+ app.route('/foo', callback=lambda: 'bar')
+ self.app.route('/foo', callback=lambda: 'baz')
+ self.assertBody('Plugin', '/foo')
+ self.assertBody('bar', '/prefix/foo')
+
+if __name__ == '__main__': #pragma: no cover
+ unittest.main()