1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
From 9f5b7a899774140f053c15ed7fd0b3c9d9b02bf8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig=20=28Debian/GNU=29?=
<umlaeute@debian.org>
Date: Wed, 31 Aug 2016 20:30:13 +0200
Subject: Serve local jquery.js
---
examples/simple_webapp.py | 5 +++++
examples/simple_webapp_decorated.py | 5 +++++
examples/simple_webapp_flask.py | 5 +++++
examples/simple_webapp_using_mongodb.py | 5 +++++
examples/simple_webapp_using_sqlite.py | 5 +++++
examples/simple_webapp_using_sqlite_mytest.py | 5 +++++
examples/templates/admin_page.html | 2 +-
7 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/examples/simple_webapp.py b/examples/simple_webapp.py
index 0dfa79f..7b5069a 100755
--- a/examples/simple_webapp.py
+++ b/examples/simple_webapp.py
@@ -188,6 +188,11 @@ def sorry_page():
return '<p>Sorry, you are not authorized to perform this action</p>'
+@bottle.route('/jquery/<filename>')
+def jquery(filename):
+ return bottle.static_file(filename, root='/usr/share/javascript/jquery')
+
+
# # Web application main # #
def main():
diff --git a/examples/simple_webapp_decorated.py b/examples/simple_webapp_decorated.py
index 0881cf9..c459c74 100755
--- a/examples/simple_webapp_decorated.py
+++ b/examples/simple_webapp_decorated.py
@@ -227,6 +227,11 @@ def sorry_page():
return '<p>Sorry, you are not authorized to perform this action</p>'
+@bottle.route('/jquery/<filename>')
+def jquery(filename):
+ return bottle.static_file(filename, root='/usr/share/javascript/jquery')
+
+
# # Web application main # #
def main():
diff --git a/examples/simple_webapp_flask.py b/examples/simple_webapp_flask.py
index 23ea85c..8ad43da 100755
--- a/examples/simple_webapp_flask.py
+++ b/examples/simple_webapp_flask.py
@@ -194,6 +194,11 @@ def sorry_page():
return '<p>Sorry, you are not authorized to perform this action</p>'
+@bottle.route('/jquery/<filename>')
+def jquery(filename):
+ return flask.static_file(filename, root='/usr/share/javascript/jquery')
+
+
# # Web application main # #
app.secret_key = os.urandom(24) #FIXME: why
diff --git a/examples/simple_webapp_using_mongodb.py b/examples/simple_webapp_using_mongodb.py
index f36ecf2..e904650 100755
--- a/examples/simple_webapp_using_mongodb.py
+++ b/examples/simple_webapp_using_mongodb.py
@@ -203,6 +203,11 @@ def sorry_page():
return '<p>Sorry, you are not authorized to perform this action</p>'
+@bottle.route('/jquery/<filename>')
+def jquery(filename):
+ return bottle.static_file(filename, root='/usr/share/javascript/jquery')
+
+
# # Web application main # #
def main():
diff --git a/examples/simple_webapp_using_sqlite.py b/examples/simple_webapp_using_sqlite.py
index 8cd2e41..7cddf93 100755
--- a/examples/simple_webapp_using_sqlite.py
+++ b/examples/simple_webapp_using_sqlite.py
@@ -210,6 +210,11 @@ def sorry_page():
return '<p>Sorry, you are not authorized to perform this action</p>'
+@bottle.route('/jquery/<filename>')
+def jquery(filename):
+ return bottle.static_file(filename, root='/usr/share/javascript/jquery')
+
+
# # Web application main # #
def main():
diff --git a/examples/simple_webapp_using_sqlite_mytest.py b/examples/simple_webapp_using_sqlite_mytest.py
index 7b5def8..865a847 100755
--- a/examples/simple_webapp_using_sqlite_mytest.py
+++ b/examples/simple_webapp_using_sqlite_mytest.py
@@ -213,6 +213,11 @@ def sorry_page():
return '<p>Sorry, you are not authorized to perform this action</p>'
+@bottle.route('/jquery/<filename>')
+def jquery(filename):
+ return bottle.static_file(filename, root='/usr/share/javascript/jquery')
+
+
# # Web application main # #
def main():
diff --git a/examples/templates/admin_page.html b/examples/templates/admin_page.html
index c39afd4..bf1b6ad 100644
--- a/examples/templates/admin_page.html
+++ b/examples/templates/admin_page.html
@@ -61,7 +61,7 @@
<div id="urls">
<a href="/">index</a> <a href="/logout">logout</a>
</div>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script src="/jquery/jquery.min.js"></script>
<script>
// Prevent form submission, send POST asynchronously and parse returned JSON
$('form').submit(function() {
|