summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-10-14 11:23:24 +0200
committerChris McDonough <chrism@plope.com>2013-10-14 11:23:24 +0200
commita87c1972615f98e99b06f9ea335a12104f67e6e0 (patch)
tree4b9f81e2ccf3a3590e539808b72ca443778b3359 /docs
parent4223668ee4c0d0ac0e981f3241d56ffa805ba6d1 (diff)
parent55917fe91b4344008da352e262dc2135629405d6 (diff)
downloadpyramid-a87c1972615f98e99b06f9ea335a12104f67e6e0.tar.gz
pyramid-a87c1972615f98e99b06f9ea335a12104f67e6e0.tar.bz2
pyramid-a87c1972615f98e99b06f9ea335a12104f67e6e0.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/introduction.rst17
-rw-r--r--docs/narr/project.rst12
-rw-r--r--docs/quick_tutorial/databases.rst11
-rw-r--r--docs/quick_tutorial/debugtoolbar/tutorial/__init__.py4
-rw-r--r--docs/quick_tutorial/ini.rst2
-rw-r--r--docs/quick_tutorial/jinja2.rst7
-rw-r--r--docs/quick_tutorial/jinja2/development.ini1
-rw-r--r--docs/quick_tutorial/jinja2/tutorial/__init__.py1
-rw-r--r--docs/quick_tutorial/more_view_classes.rst2
-rw-r--r--docs/quick_tutorial/requirements.rst2
-rw-r--r--docs/quick_tutorial/retail_forms/development.ini41
-rw-r--r--docs/quick_tutorial/retail_forms/setup.py15
-rw-r--r--docs/quick_tutorial/retail_forms/tutorial/__init__.py13
-rw-r--r--docs/quick_tutorial/retail_forms/tutorial/tests.py36
-rw-r--r--docs/quick_tutorial/retail_forms/tutorial/views.py96
-rw-r--r--docs/quick_tutorial/retail_forms/tutorial/wiki_view.pt19
-rw-r--r--docs/quick_tutorial/retail_forms/tutorial/wikipage_addedit.pt37
-rw-r--r--docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt17
-rw-r--r--docs/quick_tutorial/sessions.rst4
-rw-r--r--docs/quick_tutorial/unit_testing.rst2
-rw-r--r--docs/quick_tutorial/views.rst2
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/tests.py8
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/views.py4
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/tests.py8
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/views.py4
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/tests.py8
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/views.py4
27 files changed, 326 insertions, 51 deletions
diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst
index ece720a97..a9c5fdfbd 100644
--- a/docs/narr/introduction.rst
+++ b/docs/narr/introduction.rst
@@ -180,10 +180,9 @@ Fully Interactive Development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When developing a Pyramid application, several interactive features are
-available. Pyramid can automatically utilize changed templates when rendering
+available. Pyramid can automatically utilize changed templates when rendering
pages and automatically restart the application to incorporate changed python
-code. Plain old ``printf()`` calls used for debugging can display to a
-console.
+code. Plain old ``print()`` calls used for debugging can display to a console.
Pyramid's debug toolbar comes activated when you use a Pyramid scaffold to
render a project. This toolbar overlays your application in the browser, and
@@ -418,12 +417,12 @@ Sessions
Pyramid has built-in HTTP sessioning. This allows you to associate data with
otherwise anonymous users between requests. Lots of systems do this. But
-Pyramid also allows you to plug in your own sessioning system by creating
-some code that adheres to a documented interface. Currently there is a
-binding package for the third-party Beaker sessioning system that does exactly
-this. But if you have a specialized need (perhaps you want to store your
-session data in MongoDB), you can. You can even switch between
-implementations without changing your application code.
+Pyramid also allows you to plug in your own sessioning system by creating some
+code that adheres to a documented interface. Currently there is a binding
+package for the third-party Redis sessioning system that does exactly this.
+But if you have a specialized need (perhaps you want to store your session data
+in MongoDB), you can. You can even switch between implementations without
+changing your application code.
Example: :ref:`sessions_chapter`.
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 8b7c24725..d7292d187 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -259,6 +259,8 @@ single sample test exists.
single: reload
single: startup
+.. _running_the_project_application:
+
Running The Project Application
-------------------------------
@@ -600,6 +602,8 @@ server which listens on TCP port 6543. It is configured to listen on all
interfaces (``0.0.0.0``). This means that any remote system which has TCP
access to your system can see your Pyramid application.
+.. _MyProject_ini_logging:
+
The sections that live between the markers ``# Begin logging configuration``
and ``# End logging configuration`` represent Python's standard library
:mod:`logging` module configuration for your application. The sections
@@ -885,6 +889,14 @@ returns the HTML in a :term:`response`.
.. note:: Dictionaries provide values to :term:`template`\s.
+.. note:: When the application is run with the scaffold's :ref:`default
+ development.ini <MyProject_ini>` configuration :ref:`logging is set up
+ <MyProject_ini_logging>` to aid debugging. If an exception is raised,
+ uncaught tracebacks are displayed after the startup messages on :ref:`the
+ console running the server <running_the_project_application>`. Also
+ ``print()`` statements may be inserted into the application for debugging
+ to send output to this console.
+
.. note:: ``development.ini`` has a setting that controls how templates are
reloaded, ``pyramid.reload_templates``.
diff --git a/docs/quick_tutorial/databases.rst b/docs/quick_tutorial/databases.rst
index 93a02ffc7..20b3cd46d 100644
--- a/docs/quick_tutorial/databases.rst
+++ b/docs/quick_tutorial/databases.rst
@@ -39,15 +39,6 @@ Objectives
Steps
=====
-.. warning::
-
- Your Python might not have SQLite bundled. If not, install it into
- your virtual environment with:
-
- .. code-block:: bash
-
- $ $VENV/bin/easy_install sphinx pysqlite
-
#. We are going to use the forms step as our starting point:
.. code-block:: bash
@@ -97,7 +88,7 @@ Steps
.. code-block:: bash
- $ initialize_tutorial_db development.ini
+ $ $VENV/bin/initialize_tutorial_db development.ini
2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] PRAGMA table_info("wikipages")
2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
2013-09-06 15:54:08,051 INFO [sqlalchemy.engine.base.Engine][MainThread]
diff --git a/docs/quick_tutorial/debugtoolbar/tutorial/__init__.py b/docs/quick_tutorial/debugtoolbar/tutorial/__init__.py
index 2b4e84f30..0993b25be 100644
--- a/docs/quick_tutorial/debugtoolbar/tutorial/__init__.py
+++ b/docs/quick_tutorial/debugtoolbar/tutorial/__init__.py
@@ -3,11 +3,11 @@ from pyramid.response import Response
def hello_world(request):
- return Response('<body><h1>Hello World!</h1></body>')
+ return xResponse('<body><h1>Hello World!</h1></body>')
def main(global_config, **settings):
config = Configurator(settings=settings)
config.add_route('hello', '/')
config.add_view(hello_world, route_name='hello')
- return config.make_wsgi_app() \ No newline at end of file
+ return config.make_wsgi_app()
diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst
index 630b1faa5..618b8e5e8 100644
--- a/docs/quick_tutorial/ini.rst
+++ b/docs/quick_tutorial/ini.rst
@@ -46,7 +46,7 @@ Steps
:linenos:
#. We can now install our project, thus generating (or re-generating) an
- "egg" at ``ini/tutorial.egg-info``:
+ "egg" at ``ini/tutorial.egg-info``:
.. code-block:: bash
diff --git a/docs/quick_tutorial/jinja2.rst b/docs/quick_tutorial/jinja2.rst
index 40d941098..44d9f635b 100644
--- a/docs/quick_tutorial/jinja2.rst
+++ b/docs/quick_tutorial/jinja2.rst
@@ -29,11 +29,10 @@ Steps
$ $VENV/bin/python setup.py develop
$ $VENV/bin/easy_install pyramid_jinja2
-#. We need to add an item to ``pyramid.includes`` in
- ``jinja2/development.ini``:
+#. We need to include ``pyramid_jinja2`` in
+ ``jinja2/tutorial/__init__.py``:
- .. literalinclude:: jinja2/development.ini
- :language: ini
+ .. literalinclude:: jinja2/tutorial/__init__.py
:linenos:
#. Our ``jinja2/tutorial/views.py`` simply changes its ``renderer``:
diff --git a/docs/quick_tutorial/jinja2/development.ini b/docs/quick_tutorial/jinja2/development.ini
index c096fa936..62e0c5123 100644
--- a/docs/quick_tutorial/jinja2/development.ini
+++ b/docs/quick_tutorial/jinja2/development.ini
@@ -3,7 +3,6 @@ use = egg:tutorial
pyramid.reload_templates = true
pyramid.includes =
pyramid_debugtoolbar
- pyramid_jinja2
[server:main]
use = egg:pyramid#wsgiref
diff --git a/docs/quick_tutorial/jinja2/tutorial/__init__.py b/docs/quick_tutorial/jinja2/tutorial/__init__.py
index 013d4538f..1f6783c06 100644
--- a/docs/quick_tutorial/jinja2/tutorial/__init__.py
+++ b/docs/quick_tutorial/jinja2/tutorial/__init__.py
@@ -3,6 +3,7 @@ from pyramid.config import Configurator
def main(global_config, **settings):
config = Configurator(settings=settings)
+ config.include('pyramid_jinja2')
config.add_route('home', '/')
config.add_route('hello', '/howdy')
config.scan('.views')
diff --git a/docs/quick_tutorial/more_view_classes.rst b/docs/quick_tutorial/more_view_classes.rst
index 2792869ac..21b353b7c 100644
--- a/docs/quick_tutorial/more_view_classes.rst
+++ b/docs/quick_tutorial/more_view_classes.rst
@@ -166,7 +166,7 @@ Extra Credit
#. The ``edit`` and ``delete`` views are both submitted to with
``POST``. Why does the ``edit`` view configuration not catch the
- the ``POST`` used by ``delete``?
+ ``POST`` used by ``delete``?
#. We used Python ``@property`` on ``full_name``. If we reference this
many times in a template or view code, it would re-compute this
diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst
index 40e818807..234e4aa0d 100644
--- a/docs/quick_tutorial/requirements.rst
+++ b/docs/quick_tutorial/requirements.rst
@@ -226,7 +226,7 @@ during this tutorial:
# Mac and Linux
$ $VENV/bin/easy_install nose webtest deform sqlalchemy \
pyramid_chameleon pyramid_debugtoolbar waitress \
- pyramid_jinja2 pyramid_tm zope.sqlalchemy pysqlite
+ pyramid_jinja2 pyramid_tm zope.sqlalchemy
# Windows
c:\> %VENV%\Scripts\easy_install nose webtest deform sqlalchemy pyramid_chameleon
diff --git a/docs/quick_tutorial/retail_forms/development.ini b/docs/quick_tutorial/retail_forms/development.ini
new file mode 100644
index 000000000..62e0c5123
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/development.ini
@@ -0,0 +1,41 @@
+[app:main]
+use = egg:tutorial
+pyramid.reload_templates = true
+pyramid.includes =
+ pyramid_debugtoolbar
+
+[server:main]
+use = egg:pyramid#wsgiref
+host = 0.0.0.0
+port = 6543
+
+# Begin logging configuration
+
+[loggers]
+keys = root, tutorial
+
+[logger_tutorial]
+level = DEBUG
+handlers =
+qualname = tutorial
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+
+# End logging configuration
diff --git a/docs/quick_tutorial/retail_forms/setup.py b/docs/quick_tutorial/retail_forms/setup.py
new file mode 100644
index 000000000..361ade013
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/setup.py
@@ -0,0 +1,15 @@
+from setuptools import setup
+
+requires = [
+ 'pyramid',
+ 'pyramid_chameleon',
+ 'deform'
+]
+
+setup(name='tutorial',
+ install_requires=requires,
+ entry_points="""\
+ [paste.app_factory]
+ main = tutorial:main
+ """,
+) \ No newline at end of file
diff --git a/docs/quick_tutorial/retail_forms/tutorial/__init__.py b/docs/quick_tutorial/retail_forms/tutorial/__init__.py
new file mode 100644
index 000000000..dff7457cf
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/tutorial/__init__.py
@@ -0,0 +1,13 @@
+from pyramid.config import Configurator
+
+
+def main(global_config, **settings):
+ config = Configurator(settings=settings)
+ config.include('pyramid_chameleon')
+ config.add_route('wiki_view', '/')
+ config.add_route('wikipage_add', '/add')
+ config.add_route('wikipage_view', '/{uid}')
+ config.add_route('wikipage_edit', '/{uid}/edit')
+ config.add_static_view('deform_static', 'deform:static/')
+ config.scan('.views')
+ return config.make_wsgi_app()
diff --git a/docs/quick_tutorial/retail_forms/tutorial/tests.py b/docs/quick_tutorial/retail_forms/tutorial/tests.py
new file mode 100644
index 000000000..5a2c40904
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/tutorial/tests.py
@@ -0,0 +1,36 @@
+import unittest
+
+from pyramid import testing
+
+
+class TutorialViewTests(unittest.TestCase):
+ def setUp(self):
+ self.config = testing.setUp()
+
+ def tearDown(self):
+ testing.tearDown()
+
+ def test_home(self):
+ from .views import WikiViews
+
+ request = testing.DummyRequest()
+ inst = WikiViews(request)
+ response = inst.wiki_view()
+ self.assertEqual(len(response['pages']), 3)
+
+
+class TutorialFunctionalTests(unittest.TestCase):
+ def setUp(self):
+ from tutorial import main
+
+ app = main({})
+ from webtest import TestApp
+
+ self.testapp = TestApp(app)
+
+ def tearDown(self):
+ testing.tearDown()
+
+ def test_home(self):
+ res = self.testapp.get('/', status=200)
+ self.assertIn(b'<title>Wiki: View</title>', res.body)
diff --git a/docs/quick_tutorial/retail_forms/tutorial/views.py b/docs/quick_tutorial/retail_forms/tutorial/views.py
new file mode 100644
index 000000000..2737ebdc4
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/tutorial/views.py
@@ -0,0 +1,96 @@
+import colander
+import deform.widget
+
+from pyramid.httpexceptions import HTTPFound
+from pyramid.view import view_config
+
+pages = {
+ '100': dict(uid='100', title='Page 100', body='<em>100</em>'),
+ '101': dict(uid='101', title='Page 101', body='<em>101</em>'),
+ '102': dict(uid='102', title='Page 102', body='<em>102</em>')
+}
+
+class WikiPage(colander.MappingSchema):
+ title = colander.SchemaNode(colander.String())
+ body = colander.SchemaNode(
+ colander.String(),
+ widget=deform.widget.RichTextWidget()
+ )
+
+
+class WikiViews(object):
+ def __init__(self, request):
+ self.request = request
+
+ @property
+ def wiki_form(self):
+ schema = WikiPage()
+ return deform.Form(schema, buttons=('submit',))
+
+ @property
+ def reqts(self):
+ return self.wiki_form.get_widget_resources()
+
+ @view_config(route_name='wiki_view', renderer='wiki_view.pt')
+ def wiki_view(self):
+ return dict(pages=pages.values())
+
+ @view_config(route_name='wikipage_add',
+ renderer='wikipage_addedit.pt')
+ def wikipage_add(self):
+ form = self.wiki_form
+
+ if 'submit' in self.request.params:
+ controls = self.request.POST.items()
+ try:
+ appstruct = self.wiki_form.validate(controls)
+ except deform.ValidationFailure as e:
+ # Form is NOT valid
+ return dict(form=e.render())
+
+ # Form is valid, make a new identifier and add to list
+ last_uid = int(sorted(pages.keys())[-1])
+ new_uid = str(last_uid + 1)
+ pages[new_uid] = dict(
+ uid=new_uid, title=appstruct['title'],
+ body=appstruct['body']
+ )
+
+ # Now visit new page
+ url = self.request.route_url('wikipage_view', uid=new_uid)
+ return HTTPFound(url)
+
+ return dict(form=form)
+
+ @view_config(route_name='wikipage_view', renderer='wikipage_view.pt')
+ def wikipage_view(self):
+ uid = self.request.matchdict['uid']
+ page = pages[uid]
+ return dict(page=page)
+
+ @view_config(route_name='wikipage_edit',
+ renderer='wikipage_addedit.pt')
+ def wikipage_edit(self):
+ uid = self.request.matchdict['uid']
+ page = pages[uid]
+
+ wiki_form = self.wiki_form
+
+ if 'submit' in self.request.params:
+ controls = self.request.POST.items()
+ try:
+ appstruct = wiki_form.validate(controls)
+ except deform.ValidationFailure as e:
+ return dict(page=page, form=e.render())
+
+ # Change the content and redirect to the view
+ page['title'] = appstruct['title']
+ page['body'] = appstruct['body']
+
+ url = self.request.route_url('wikipage_view',
+ uid=page['uid'])
+ return HTTPFound(url)
+
+ form = wiki_form.render(page)
+
+ return dict(page=page, form=form) \ No newline at end of file
diff --git a/docs/quick_tutorial/retail_forms/tutorial/wiki_view.pt b/docs/quick_tutorial/retail_forms/tutorial/wiki_view.pt
new file mode 100644
index 000000000..9e3afe495
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/tutorial/wiki_view.pt
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>Wiki: View</title>
+</head>
+<body>
+<h1>Wiki</h1>
+
+<a href="${request.route_url('wikipage_add')}">Add
+ WikiPage</a>
+<ul>
+ <li tal:repeat="page pages">
+ <a href="${request.route_url('wikipage_view', uid=page.uid)}">
+ ${page.title}
+ </a>
+ </li>
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tutorial/retail_forms/tutorial/wikipage_addedit.pt b/docs/quick_tutorial/retail_forms/tutorial/wikipage_addedit.pt
new file mode 100644
index 000000000..586f4c44b
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/tutorial/wikipage_addedit.pt
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>WikiPage: Add/Edit</title>
+ <tal:block tal:repeat="reqt view.reqts['css']">
+ <link rel="stylesheet" type="text/css"
+ href="${request.static_url('deform:static/' + reqt)}"/>
+ </tal:block>
+ <tal:block tal:repeat="reqt view.reqts['js']">
+ <script src="${request.static_url('deform:static/' + reqt)}"
+ type="text/javascript"></script>
+ </tal:block>
+</head>
+<body>
+<h1>Wiki</h1>
+
+<div class="row"
+ tal:repeat="field form">
+ <div class="span2">
+ ${structure:field.title}
+ <span class="req" tal:condition="field.required">*</span>
+ </div>
+ <div class="span2">
+ ${structure:field.serialize()}
+ </div>
+ <ul tal:condition="field.error">
+ <li tal:repeat="error field.error.messages()">
+ ${structure:error}
+ </li>
+ </ul>
+</div>
+
+<script type="text/javascript">
+ deform.load()
+</script>
+</body>
+</html>
diff --git a/docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt b/docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt
new file mode 100644
index 000000000..cb9ff526e
--- /dev/null
+++ b/docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>WikiPage: View</title>
+</head>
+<body>
+<a href="${request.route_url('wiki_view')}">
+ Up
+</a> |
+<a href="${request.route_url('wikipage_edit', uid=page.uid)}">
+ Edit
+</a>
+
+<h1>${page.title}</h1>
+<p>${structure: page.body}</p>
+</body>
+</html> \ No newline at end of file
diff --git a/docs/quick_tutorial/sessions.rst b/docs/quick_tutorial/sessions.rst
index ba26d0133..0f284e9a7 100644
--- a/docs/quick_tutorial/sessions.rst
+++ b/docs/quick_tutorial/sessions.rst
@@ -13,8 +13,8 @@ When people use your web application, they frequently perform a task
that requires semi-permanent data to be saved. For example, a shopping
cart. This is called a :term:`session`.
-Pyramid has basic built-in support for sessions, with add-ons such as
-*dogpile.cache* (or your own custom sessioning engine) that provide
+Pyramid has basic built-in support for sessions, with add-ons
+or your own custom sessioning engine) that can provide
richer session support. Let's take a look at the
:ref:`built-in sessioning support <sessions_chapter>`.
diff --git a/docs/quick_tutorial/unit_testing.rst b/docs/quick_tutorial/unit_testing.rst
index 73b33c588..ed33f62d7 100644
--- a/docs/quick_tutorial/unit_testing.rst
+++ b/docs/quick_tutorial/unit_testing.rst
@@ -77,7 +77,7 @@ some ``pyramid.testing`` helpers which we use in the test setup and
teardown. Our one test imports the view, makes a dummy request, and sees
if the view returns what we expected.
-The ``tests.HelloWorldViewTests.test_hello_world`` test is a small
+The ``tests.TutorialViewTests.test_hello_world`` test is a small
example of a unit test. First, we import the view inside each test. Why
not import at the top, like in normal Python code? Because imports can
cause effects that break a test. We'd like our tests to be in *units*,
diff --git a/docs/quick_tutorial/views.rst b/docs/quick_tutorial/views.rst
index 15785e902..529bba0a4 100644
--- a/docs/quick_tutorial/views.rst
+++ b/docs/quick_tutorial/views.rst
@@ -42,7 +42,7 @@ Steps
.. code-block:: bash
- $ cd ..; cp -r function_testing views; cd views
+ $ cd ..; cp -r functional_testing views; cd views
$ $VENV/bin/python setup.py develop
#. Our ``views/tutorial/__init__.py`` gets a lot shorter:
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py
index 5dcee127b..9f01d2da5 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py
@@ -14,7 +14,7 @@ def _initTestingDB():
Base.metadata.create_all(engine)
DBSession.configure(bind=engine)
with transaction.manager:
- model = Page('FrontPage', 'This is the front page')
+ model = Page(name='FrontPage', data='This is the front page')
DBSession.add(model)
return DBSession
@@ -59,7 +59,7 @@ class ViewPageTests(unittest.TestCase):
from tutorial.models import Page
request = testing.DummyRequest()
request.matchdict['pagename'] = 'IDoExist'
- page = Page('IDoExist', 'Hello CruelWorld IDoExist')
+ page = Page(name='IDoExist', data='Hello CruelWorld IDoExist')
self.session.add(page)
_registerRoutes(self.config)
info = self._callFUT(request)
@@ -126,7 +126,7 @@ class EditPageTests(unittest.TestCase):
_registerRoutes(self.config)
request = testing.DummyRequest()
request.matchdict = {'pagename':'abc'}
- page = Page('abc', 'hello')
+ page = Page(name='abc', data='hello')
self.session.add(page)
info = self._callFUT(request)
self.assertEqual(info['page'], page)
@@ -139,7 +139,7 @@ class EditPageTests(unittest.TestCase):
request = testing.DummyRequest({'form.submitted':True,
'body':'Hello yo!'})
request.matchdict = {'pagename':'abc'}
- page = Page('abc', 'hello')
+ page = Page(name='abc', data='hello')
self.session.add(page)
response = self._callFUT(request)
self.assertEqual(response.location, 'http://example.com/abc')
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/views.py b/docs/tutorials/wiki2/src/authorization/tutorial/views.py
index 0d085b0e2..b6dbbf5f6 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/views.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/views.py
@@ -63,12 +63,12 @@ def add_page(request):
pagename = request.matchdict['pagename']
if 'form.submitted' in request.params:
body = request.params['body']
- page = Page(pagename, body)
+ page = Page(name=pagename, data=body)
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=pagename))
save_url = request.route_url('add_page', pagename=pagename)
- page = Page('', '')
+ page = Page(name='', data='')
return dict(page=page, save_url=save_url,
logged_in=authenticated_userid(request))
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/tests.py b/docs/tutorials/wiki2/src/tests/tutorial/tests.py
index 3e96d0a82..4ee30685e 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/tests/tutorial/tests.py
@@ -15,7 +15,7 @@ def _initTestingDB():
Base.metadata.create_all(engine)
DBSession.configure(bind=engine)
with transaction.manager:
- model = Page('FrontPage', 'This is the front page')
+ model = Page(name='FrontPage', data='This is the front page')
DBSession.add(model)
return DBSession
@@ -82,7 +82,7 @@ class ViewPageTests(unittest.TestCase):
from tutorial.models import Page
request = testing.DummyRequest()
request.matchdict['pagename'] = 'IDoExist'
- page = Page('IDoExist', 'Hello CruelWorld IDoExist')
+ page = Page(name='IDoExist', data='Hello CruelWorld IDoExist')
self.session.add(page)
_registerRoutes(self.config)
info = self._callFUT(request)
@@ -150,7 +150,7 @@ class EditPageTests(unittest.TestCase):
_registerRoutes(self.config)
request = testing.DummyRequest()
request.matchdict = {'pagename':'abc'}
- page = Page('abc', 'hello')
+ page = Page(name='abc', data='hello')
self.session.add(page)
info = self._callFUT(request)
self.assertEqual(info['page'], page)
@@ -163,7 +163,7 @@ class EditPageTests(unittest.TestCase):
request = testing.DummyRequest({'form.submitted':True,
'body':'Hello yo!'})
request.matchdict = {'pagename':'abc'}
- page = Page('abc', 'hello')
+ page = Page(name='abc', data='hello')
self.session.add(page)
response = self._callFUT(request)
self.assertEqual(response.location, 'http://example.com/abc')
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/views.py b/docs/tutorials/wiki2/src/tests/tutorial/views.py
index 0d085b0e2..b6dbbf5f6 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/views.py
+++ b/docs/tutorials/wiki2/src/tests/tutorial/views.py
@@ -63,12 +63,12 @@ def add_page(request):
pagename = request.matchdict['pagename']
if 'form.submitted' in request.params:
body = request.params['body']
- page = Page(pagename, body)
+ page = Page(name=pagename, data=body)
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=pagename))
save_url = request.route_url('add_page', pagename=pagename)
- page = Page('', '')
+ page = Page(name='', data='')
return dict(page=page, save_url=save_url,
logged_in=authenticated_userid(request))
diff --git a/docs/tutorials/wiki2/src/views/tutorial/tests.py b/docs/tutorials/wiki2/src/views/tutorial/tests.py
index 5dcee127b..9f01d2da5 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/tests.py
@@ -14,7 +14,7 @@ def _initTestingDB():
Base.metadata.create_all(engine)
DBSession.configure(bind=engine)
with transaction.manager:
- model = Page('FrontPage', 'This is the front page')
+ model = Page(name='FrontPage', data='This is the front page')
DBSession.add(model)
return DBSession
@@ -59,7 +59,7 @@ class ViewPageTests(unittest.TestCase):
from tutorial.models import Page
request = testing.DummyRequest()
request.matchdict['pagename'] = 'IDoExist'
- page = Page('IDoExist', 'Hello CruelWorld IDoExist')
+ page = Page(name='IDoExist', data='Hello CruelWorld IDoExist')
self.session.add(page)
_registerRoutes(self.config)
info = self._callFUT(request)
@@ -126,7 +126,7 @@ class EditPageTests(unittest.TestCase):
_registerRoutes(self.config)
request = testing.DummyRequest()
request.matchdict = {'pagename':'abc'}
- page = Page('abc', 'hello')
+ page = Page(name='abc', data='hello')
self.session.add(page)
info = self._callFUT(request)
self.assertEqual(info['page'], page)
@@ -139,7 +139,7 @@ class EditPageTests(unittest.TestCase):
request = testing.DummyRequest({'form.submitted':True,
'body':'Hello yo!'})
request.matchdict = {'pagename':'abc'}
- page = Page('abc', 'hello')
+ page = Page(name='abc', data='hello')
self.session.add(page)
response = self._callFUT(request)
self.assertEqual(response.location, 'http://example.com/abc')
diff --git a/docs/tutorials/wiki2/src/views/tutorial/views.py b/docs/tutorials/wiki2/src/views/tutorial/views.py
index 5a9c75a61..42ef77b98 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/views.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/views.py
@@ -47,12 +47,12 @@ def add_page(request):
pagename = request.matchdict['pagename']
if 'form.submitted' in request.params:
body = request.params['body']
- page = Page(pagename, body)
+ page = Page(name=pagename, data=body)
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=pagename))
save_url = request.route_url('add_page', pagename=pagename)
- page = Page('', '')
+ page = Page(name='', data='')
return dict(page=page, save_url=save_url)
@view_config(route_name='edit_page', renderer='templates/edit.pt')