summaryrefslogtreecommitdiff
path: root/docs/quick_tour
diff options
context:
space:
mode:
Diffstat (limited to 'docs/quick_tour')
-rw-r--r--docs/quick_tour/hello_world/app.py2
-rw-r--r--docs/quick_tour/jinja2/app.py2
-rw-r--r--docs/quick_tour/jinja2/views.py2
-rw-r--r--docs/quick_tour/json/app.py4
-rw-r--r--docs/quick_tour/json/hello_world.jinja24
-rw-r--r--docs/quick_tour/json/hello_world.pt17
-rw-r--r--docs/quick_tour/json/views.py4
-rw-r--r--docs/quick_tour/requests/app.py2
-rw-r--r--docs/quick_tour/routing/app.py2
-rw-r--r--docs/quick_tour/routing/views.py2
-rw-r--r--docs/quick_tour/static_assets/app.py4
-rw-r--r--docs/quick_tour/static_assets/hello_world.jinja22
-rw-r--r--docs/quick_tour/static_assets/hello_world.pt16
-rw-r--r--docs/quick_tour/static_assets/hello_world_static.jinja210
-rw-r--r--docs/quick_tour/static_assets/views.py2
-rw-r--r--docs/quick_tour/templating/app.py3
-rw-r--r--docs/quick_tour/templating/views.py2
-rw-r--r--docs/quick_tour/view_classes/app.py6
-rw-r--r--docs/quick_tour/view_classes/hello.jinja28
-rw-r--r--docs/quick_tour/view_classes/views.py2
-rw-r--r--docs/quick_tour/views/app.py2
21 files changed, 29 insertions, 69 deletions
diff --git a/docs/quick_tour/hello_world/app.py b/docs/quick_tour/hello_world/app.py
index df5a6cf18..75d22ac96 100644
--- a/docs/quick_tour/hello_world/app.py
+++ b/docs/quick_tour/hello_world/app.py
@@ -13,4 +13,4 @@ if __name__ == '__main__':
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/jinja2/app.py b/docs/quick_tour/jinja2/app.py
index 83af219db..b7632807b 100644
--- a/docs/quick_tour/jinja2/app.py
+++ b/docs/quick_tour/jinja2/app.py
@@ -8,4 +8,4 @@ if __name__ == '__main__':
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/jinja2/views.py b/docs/quick_tour/jinja2/views.py
index 916cdc720..7dbb45287 100644
--- a/docs/quick_tour/jinja2/views.py
+++ b/docs/quick_tour/jinja2/views.py
@@ -1,8 +1,6 @@
from pyramid.view import view_config
-# Start View 1
@view_config(route_name='hello', renderer='hello_world.jinja2')
-# End View 1
def hello_world(request):
return dict(name=request.matchdict['name'])
diff --git a/docs/quick_tour/json/app.py b/docs/quick_tour/json/app.py
index 950cb478f..40faddd00 100644
--- a/docs/quick_tour/json/app.py
+++ b/docs/quick_tour/json/app.py
@@ -1,8 +1,6 @@
from wsgiref.simple_server import make_server
-
from pyramid.config import Configurator
-
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/howdy/{name}')
@@ -12,4 +10,4 @@ if __name__ == '__main__':
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/json/hello_world.jinja2 b/docs/quick_tour/json/hello_world.jinja2
index f6862e618..4fb9be074 100644
--- a/docs/quick_tour/json/hello_world.jinja2
+++ b/docs/quick_tour/json/hello_world.jinja2
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Glance</title>
- <link rel="stylesheet" href="/static/app.css"/>
+ <title>Hello World</title>
+ <link rel="stylesheet" href="{{ request.static_url('static/app.css') }}"/>
</head>
<body>
<h1>Hello {{ name }}!</h1>
diff --git a/docs/quick_tour/json/hello_world.pt b/docs/quick_tour/json/hello_world.pt
deleted file mode 100644
index 711054aa9..000000000
--- a/docs/quick_tour/json/hello_world.pt
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <title>Quick Glance</title>
- <!-- Start Link 1 -->
- <link rel="stylesheet" href="/static/app.css" />
- <!-- End Link 1 -->
- <!-- Start Link 2 -->
- <link rel="stylesheet"
- href="${request.static_url('static/app.css')}"
- />
- <!-- End Link 2 -->
-</head>
-<body>
-<h1>Hello ${name}!</h1>
-</body>
-</html> \ No newline at end of file
diff --git a/docs/quick_tour/json/views.py b/docs/quick_tour/json/views.py
index 583e220c7..22aa8aad6 100644
--- a/docs/quick_tour/json/views.py
+++ b/docs/quick_tour/json/views.py
@@ -1,13 +1,11 @@
from pyramid.view import view_config
-@view_config(route_name='hello', renderer='hello_world.pt')
+@view_config(route_name='hello', renderer='hello_world.jinja2')
def hello_world(request):
return dict(name=request.matchdict['name'])
-# Start View 1
@view_config(route_name='hello_json', renderer='json')
def hello_json(request):
return [1, 2, 3]
- # End View 1 \ No newline at end of file
diff --git a/docs/quick_tour/requests/app.py b/docs/quick_tour/requests/app.py
index 815714464..621b0693e 100644
--- a/docs/quick_tour/requests/app.py
+++ b/docs/quick_tour/requests/app.py
@@ -21,4 +21,4 @@ if __name__ == '__main__':
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/routing/app.py b/docs/quick_tour/routing/app.py
index 04a8a6344..12b547bfe 100644
--- a/docs/quick_tour/routing/app.py
+++ b/docs/quick_tour/routing/app.py
@@ -3,9 +3,7 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
- # Start Route 1
config.add_route('hello', '/howdy/{first}/{last}')
- # End Route 1
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
diff --git a/docs/quick_tour/routing/views.py b/docs/quick_tour/routing/views.py
index 8cb8d3780..8a3bd230e 100644
--- a/docs/quick_tour/routing/views.py
+++ b/docs/quick_tour/routing/views.py
@@ -2,9 +2,7 @@ from pyramid.response import Response
from pyramid.view import view_config
-# Start Route 1
@view_config(route_name='hello')
def hello_world(request):
body = '<h1>Hi %(first)s %(last)s!</h1>' % request.matchdict
return Response(body)
- # End Route 1 \ No newline at end of file
diff --git a/docs/quick_tour/static_assets/app.py b/docs/quick_tour/static_assets/app.py
index 9c808972f..1849c0a5a 100644
--- a/docs/quick_tour/static_assets/app.py
+++ b/docs/quick_tour/static_assets/app.py
@@ -4,11 +4,9 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/howdy/{name}')
- # Start Static 1
config.add_static_view(name='static', path='static')
- # End Static 1
config.include('pyramid_jinja2')
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/static_assets/hello_world.jinja2 b/docs/quick_tour/static_assets/hello_world.jinja2
index f6862e618..0fb2ce296 100644
--- a/docs/quick_tour/static_assets/hello_world.jinja2
+++ b/docs/quick_tour/static_assets/hello_world.jinja2
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Glance</title>
+ <title>Hello World</title>
<link rel="stylesheet" href="/static/app.css"/>
</head>
<body>
diff --git a/docs/quick_tour/static_assets/hello_world.pt b/docs/quick_tour/static_assets/hello_world.pt
deleted file mode 100644
index 1797146eb..000000000
--- a/docs/quick_tour/static_assets/hello_world.pt
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html lang="en"><head>
- <title>Quick Glance</title>
- <!-- Start Link 1 -->
- <link rel="stylesheet" href="/static/app.css" />
- <!-- End Link 1 -->
- <!-- Start Link 2 -->
- <link rel="stylesheet"
- href="${request.static_url('static/app.css')}"
- />
- <!-- End Link 2 -->
-</head>
-<body>
-<h1>Hello ${name}!</h1>
-</body>
-</html> \ No newline at end of file
diff --git a/docs/quick_tour/static_assets/hello_world_static.jinja2 b/docs/quick_tour/static_assets/hello_world_static.jinja2
new file mode 100644
index 000000000..4fb9be074
--- /dev/null
+++ b/docs/quick_tour/static_assets/hello_world_static.jinja2
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Hello World</title>
+ <link rel="stylesheet" href="{{ request.static_url('static/app.css') }}"/>
+</head>
+<body>
+<h1>Hello {{ name }}!</h1>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tour/static_assets/views.py b/docs/quick_tour/static_assets/views.py
index 90730ae32..7dbb45287 100644
--- a/docs/quick_tour/static_assets/views.py
+++ b/docs/quick_tour/static_assets/views.py
@@ -1,6 +1,6 @@
from pyramid.view import view_config
-@view_config(route_name='hello', renderer='hello_world.pt')
+@view_config(route_name='hello', renderer='hello_world.jinja2')
def hello_world(request):
return dict(name=request.matchdict['name'])
diff --git a/docs/quick_tour/templating/app.py b/docs/quick_tour/templating/app.py
index 6d1a29f4e..52b7faf55 100644
--- a/docs/quick_tour/templating/app.py
+++ b/docs/quick_tour/templating/app.py
@@ -4,7 +4,8 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/howdy/{name}')
+ config.include('pyramid_chameleon')
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/templating/views.py b/docs/quick_tour/templating/views.py
index 6c7846efa..90730ae32 100644
--- a/docs/quick_tour/templating/views.py
+++ b/docs/quick_tour/templating/views.py
@@ -1,8 +1,6 @@
from pyramid.view import view_config
-# Start View 1
@view_config(route_name='hello', renderer='hello_world.pt')
def hello_world(request):
return dict(name=request.matchdict['name'])
- # End View 1 \ No newline at end of file
diff --git a/docs/quick_tour/view_classes/app.py b/docs/quick_tour/view_classes/app.py
index 468c8c29e..40faddd00 100644
--- a/docs/quick_tour/view_classes/app.py
+++ b/docs/quick_tour/view_classes/app.py
@@ -3,11 +3,11 @@ from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
- # Start Routes 1
config.add_route('hello', '/howdy/{name}')
- # End Routes 1
+ config.add_route('hello_json', 'hello.json')
+ config.add_static_view(name='static', path='static')
config.include('pyramid_jinja2')
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()
diff --git a/docs/quick_tour/view_classes/hello.jinja2 b/docs/quick_tour/view_classes/hello.jinja2
index 3446b96ce..fc3058067 100644
--- a/docs/quick_tour/view_classes/hello.jinja2
+++ b/docs/quick_tour/view_classes/hello.jinja2
@@ -5,13 +5,11 @@
</head>
<body>
<h1>Hello {{ view.name }}!</h1>
-<!-- Start Form 1 -->
<form method="POST"
action="{{ request.current_route_url() }}">
- <input name="new_name"/>
- <input type="submit" name="form.edit" value="Save"/>
- <input type="submit" name="form.delete" value="Delete"/>
+ <input name="new_name">
+ <input type="submit" name="form.edit" value="Save">
+ <input type="submit" name="form.delete" value="Delete">
</form>
-<!-- End Form 1 -->
</body>
</html> \ No newline at end of file
diff --git a/docs/quick_tour/view_classes/views.py b/docs/quick_tour/view_classes/views.py
index 62556142e..10ff238c7 100644
--- a/docs/quick_tour/view_classes/views.py
+++ b/docs/quick_tour/view_classes/views.py
@@ -4,7 +4,6 @@ from pyramid.view import (
)
-# Start View 1
# One route, at /howdy/amy, so don't repeat on each @view_config
@view_defaults(route_name='hello')
class HelloWorldViews:
@@ -29,4 +28,3 @@ class HelloWorldViews:
def delete_view(self):
print('Deleted')
return dict()
- # End View 1 \ No newline at end of file
diff --git a/docs/quick_tour/views/app.py b/docs/quick_tour/views/app.py
index 54dc9ed4b..e8df6eff2 100644
--- a/docs/quick_tour/views/app.py
+++ b/docs/quick_tour/views/app.py
@@ -10,4 +10,4 @@ if __name__ == '__main__':
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()