diff --git a/docs/quick_tutorial/retail_forms/development.ini b/docs/quick_tutorial/retail_forms/development.ini deleted file mode 100644 index 78d7479e7c..0000000000 --- a/docs/quick_tutorial/retail_forms/development.ini +++ /dev/null @@ -1,9 +0,0 @@ -[app:main] -use = egg:tutorial -pyramid.reload_templates = true -pyramid.includes = - pyramid_debugtoolbar - -[server:main] -use = egg:waitress#main -listen = localhost:6543 diff --git a/docs/quick_tutorial/retail_forms/setup.py b/docs/quick_tutorial/retail_forms/setup.py deleted file mode 100644 index dda0a2cc4e..0000000000 --- a/docs/quick_tutorial/retail_forms/setup.py +++ /dev/null @@ -1,20 +0,0 @@ -from setuptools import setup - -# List of dependencies installed via `pip install -e .` -# by virtue of the Setuptools `install_requires` value below. -requires = [ - 'deform', - 'pyramid', - 'pyramid_chameleon', - 'waitress', -] - -setup( - name='tutorial', - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main' - ], - }, -) diff --git a/docs/quick_tutorial/retail_forms/tutorial/__init__.py b/docs/quick_tutorial/retail_forms/tutorial/__init__.py deleted file mode 100644 index dff7457cfe..0000000000 --- a/docs/quick_tutorial/retail_forms/tutorial/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index 5a2c409046..0000000000 --- a/docs/quick_tutorial/retail_forms/tutorial/tests.py +++ /dev/null @@ -1,36 +0,0 @@ -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'Wiki: View', res.body) diff --git a/docs/quick_tutorial/retail_forms/tutorial/views.py b/docs/quick_tutorial/retail_forms/tutorial/views.py deleted file mode 100644 index c6f4e38773..0000000000 --- a/docs/quick_tutorial/retail_forms/tutorial/views.py +++ /dev/null @@ -1,96 +0,0 @@ -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='100'), - '101': dict(uid='101', title='Page 101', body='101'), - '102': dict(uid='102', title='Page 102', body='102') -} - -class WikiPage(colander.MappingSchema): - title = colander.SchemaNode(colander.String()) - body = colander.SchemaNode( - colander.String(), - widget=deform.widget.RichTextWidget() - ) - - -class WikiViews: - 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 deleted file mode 100644 index 9e3afe4950..0000000000 --- a/docs/quick_tutorial/retail_forms/tutorial/wiki_view.pt +++ /dev/null @@ -1,19 +0,0 @@ - - - - Wiki: View - - -

Wiki

- -Add - WikiPage - - - \ 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 deleted file mode 100644 index 586f4c44b1..0000000000 --- a/docs/quick_tutorial/retail_forms/tutorial/wikipage_addedit.pt +++ /dev/null @@ -1,37 +0,0 @@ - - - - WikiPage: Add/Edit - - - - - - - - -

Wiki

- -
-
- ${structure:field.title} - * -
-
- ${structure:field.serialize()} -
- -
- - - - diff --git a/docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt b/docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt deleted file mode 100644 index cb9ff526e7..0000000000 --- a/docs/quick_tutorial/retail_forms/tutorial/wikipage_view.pt +++ /dev/null @@ -1,17 +0,0 @@ - - - - WikiPage: View - - - - Up - | - - Edit - - -

${page.title}

-

${structure: page.body}

- - \ No newline at end of file