summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2019-12-28 00:21:57 -0800
committerSteve Piercy <web@stevepiercy.com>2020-01-02 23:30:59 -0800
commit57fe1b6cb76717404ccc1777f2f3a4e6bf6b37a4 (patch)
treeac14111afc02539fb245c8a88953bae939b2cd0f /docs/tutorials/wiki
parent2e73919835c6480b6c5eb57dfb368812d6df9d43 (diff)
downloadpyramid-57fe1b6cb76717404ccc1777f2f3a4e6bf6b37a4.tar.gz
pyramid-57fe1b6cb76717404ccc1777f2f3a4e6bf6b37a4.tar.bz2
pyramid-57fe1b6cb76717404ccc1777f2f3a4e6bf6b37a4.zip
Update docs/tutorials/wiki/definingviews.rst and related src files, and models src files
Diffstat (limited to 'docs/tutorials/wiki')
-rw-r--r--docs/tutorials/wiki/definingviews.rst4
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/templates/layout.pt2
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/tests.py6
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/views/default.py2
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/views/notfound.py2
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/layout.pt2
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/tests.py6
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/views/default.py6
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/views/notfound.py2
9 files changed, 22 insertions, 10 deletions
diff --git a/docs/tutorials/wiki/definingviews.rst b/docs/tutorials/wiki/definingviews.rst
index bd8dc6ecf..2e4d009a1 100644
--- a/docs/tutorials/wiki/definingviews.rst
+++ b/docs/tutorials/wiki/definingviews.rst
@@ -73,7 +73,7 @@ Success executing this command will end with a line to the console similar to th
.. code-block:: text
- Successfully installed docutils-0.14 tutorial
+ Successfully installed docutils-0.15.2 tutorial
Adding view functions in the ``views`` package
@@ -356,7 +356,7 @@ Our templates name static assets, including CSS and images.
We don't need to create these files within our package's ``static`` directory because they were provided by the cookiecutter at the time we created the project.
As an example, the CSS file will be accessed via ``http://localhost:6543/static/theme.css`` by virtue of the call to the ``add_static_view`` directive in the ``routes.py`` file.
-Any number and type of static assets can be placed in this directory (or subdirectories)
+Any number and type of static assets can be placed in this directory (or subdirectories).
They are referred to by either URL or using the convenience method ``static_url``, for example ``request.static_url('<package>:static/foo.css')``, within templates.
diff --git a/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt
index 9fdaef00f..9ca01382b 100644
--- a/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt
+++ b/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt
@@ -1,5 +1,5 @@
<!DOCTYPE html metal:define-macro="layout">
-<html lang="{{request.locale_name}}">
+<html lang="${request.locale_name}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/models/tutorial/tests.py b/docs/tutorials/wiki/src/models/tutorial/tests.py
index 6279d9f66..aa5641cdd 100644
--- a/docs/tutorials/wiki/src/models/tutorial/tests.py
+++ b/docs/tutorials/wiki/src/models/tutorial/tests.py
@@ -16,3 +16,9 @@ class ViewTests(unittest.TestCase):
info = my_view(request)
self.assertEqual(info['project'], 'myproj')
+ def test_notfound_view(self):
+ from .views.notfound import notfound_view
+ request = testing.DummyRequest()
+ info = notfound_view(request)
+ self.assertEqual(info, {})
+
diff --git a/docs/tutorials/wiki/src/models/tutorial/views/default.py b/docs/tutorials/wiki/src/models/tutorial/views/default.py
index 5d708d15c..51ec5ed98 100644
--- a/docs/tutorials/wiki/src/models/tutorial/views/default.py
+++ b/docs/tutorials/wiki/src/models/tutorial/views/default.py
@@ -3,6 +3,6 @@ from pyramid.view import view_config
from ..models import MyModel
-@view_config(context=MyModel, renderer='../templates/mytemplate.pt')
+@view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt')
def my_view(request):
return {'project': 'myproj'}
diff --git a/docs/tutorials/wiki/src/models/tutorial/views/notfound.py b/docs/tutorials/wiki/src/models/tutorial/views/notfound.py
index 728791d0a..59a37280e 100644
--- a/docs/tutorials/wiki/src/models/tutorial/views/notfound.py
+++ b/docs/tutorials/wiki/src/models/tutorial/views/notfound.py
@@ -1,7 +1,7 @@
from pyramid.view import notfound_view_config
-@notfound_view_config(renderer='../templates/404.pt')
+@notfound_view_config(renderer='tutorial:templates/404.pt')
def notfound_view(request):
request.response.status = 404
return {}
diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt
index b606e8dad..06a3c8157 100644
--- a/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt
+++ b/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt
@@ -1,5 +1,5 @@
<!DOCTYPE html metal:define-macro="layout">
-<html lang="{{request.locale_name}}">
+<html lang="${request.locale_name}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/views/tutorial/tests.py b/docs/tutorials/wiki/src/views/tutorial/tests.py
index 6279d9f66..aa5641cdd 100644
--- a/docs/tutorials/wiki/src/views/tutorial/tests.py
+++ b/docs/tutorials/wiki/src/views/tutorial/tests.py
@@ -16,3 +16,9 @@ class ViewTests(unittest.TestCase):
info = my_view(request)
self.assertEqual(info['project'], 'myproj')
+ def test_notfound_view(self):
+ from .views.notfound import notfound_view
+ request = testing.DummyRequest()
+ info = notfound_view(request)
+ self.assertEqual(info, {})
+
diff --git a/docs/tutorials/wiki/src/views/tutorial/views/default.py b/docs/tutorials/wiki/src/views/tutorial/views/default.py
index b4b65a49b..e7921cf2f 100644
--- a/docs/tutorials/wiki/src/views/tutorial/views/default.py
+++ b/docs/tutorials/wiki/src/views/tutorial/views/default.py
@@ -15,7 +15,7 @@ def view_wiki(context, request):
return HTTPFound(location=request.resource_url(context, 'FrontPage'))
-@view_config(context='..models.Page', renderer='../templates/view.pt')
+@view_config(context='..models.Page', renderer='tutorial:templates/view.pt')
def view_page(context, request):
wiki = context.__parent__
@@ -36,7 +36,7 @@ def view_page(context, request):
@view_config(name='add_page', context='..models.Wiki',
- renderer='../templates/edit.pt')
+ renderer='tutorial:templates/edit.pt')
def add_page(context, request):
pagename = request.subpath[0]
if 'form.submitted' in request.params:
@@ -54,7 +54,7 @@ def add_page(context, request):
@view_config(name='edit_page', context='..models.Page',
- renderer='../templates/edit.pt')
+ renderer='tutorial:templates/edit.pt')
def edit_page(context, request):
if 'form.submitted' in request.params:
context.data = request.params['body']
diff --git a/docs/tutorials/wiki/src/views/tutorial/views/notfound.py b/docs/tutorials/wiki/src/views/tutorial/views/notfound.py
index d44b4d0e6..dd0b00488 100644
--- a/docs/tutorials/wiki/src/views/tutorial/views/notfound.py
+++ b/docs/tutorials/wiki/src/views/tutorial/views/notfound.py
@@ -3,7 +3,7 @@ from pyramid.view import notfound_view_config
from ..models import Page
-@notfound_view_config(renderer='../templates/404.pt')
+@notfound_view_config(renderer='tutorial:templates/404.pt')
def notfound_view(request):
request.response.status = 404
pagename = request.path