From 39f8a04ca89dfb43c79bf3c4c31400061a5cf1e0 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 4 Nov 2010 03:58:53 -0400 Subject: fix wiki2 tutorial (it was busted) --- TODO.txt | 2 ++ docs/tutorials/wiki2/definingmodels.rst | 8 +++++--- docs/tutorials/wiki2/src/authorization/tutorial/__init__.py | 13 +++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/TODO.txt b/TODO.txt index a3fe68958..e66240bbb 100644 --- a/TODO.txt +++ b/TODO.txt @@ -90,3 +90,5 @@ pyramid_zodbsessions package. - repoze.bfg.viewgroup in CMF tutorial + +- templates in tutorials. diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst index 9fb0c5d9c..c25eb2864 100644 --- a/docs/tutorials/wiki2/definingmodels.rst +++ b/docs/tutorials/wiki2/definingmodels.rst @@ -22,9 +22,9 @@ Making Edits to ``models.py`` Python subpackage of your application package named ``models``) , but this is only by convention. -The first thing we want to do is remove the stock ``Model`` class from -the generated ``models.py`` file. The ``Model`` class is only a -sample and we're not going to use it. +The first thing we want to do is remove the stock ``MyModel`` class from the +generated ``models.py`` file. The ``MyModel`` class is only a sample and +we're not going to use it. Then, we'll add a ``Page`` class. Because this is a SQLAlchemy application, this class should inherit from an instance of @@ -76,3 +76,5 @@ that ends with this exception: .. code-block:: text ImportError: cannot import name MyModel + +This will also happen if you attempt to run the tests. diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py b/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py index 8c93e5d5a..a47b6dc32 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/__init__.py @@ -5,6 +5,7 @@ from pyramid.authorization import ACLAuthorizationPolicy from paste.deploy.converters import asbool from tutorial.models import initialize_sql +from tutorial.security import groupfinder def app(global_config, **settings): """ This function returns a WSGI application. @@ -18,7 +19,7 @@ def app(global_config, **settings): db_echo = settings.get('db_echo', 'false') initialize_sql(db_string, asbool(db_echo)) authn_policy = AuthTktAuthenticationPolicy( - 'sosecret', callback='tutorial.security.groupfinder') + 'sosecret', callback=groupfinder) authz_policy = ACLAuthorizationPolicy() config = Configurator(settings=settings, root_factory='tutorial.models.RootFactory', @@ -27,6 +28,11 @@ def app(global_config, **settings): config.begin() config.add_static_view('static', 'templates/static') config.add_route('view_wiki', '/', view='tutorial.views.view_wiki') + config.add_route('login', '/login', + view='tutorial.login.login', + view_renderer='tutorial:templates/login.pt') + config.add_route('logout', '/logout', + view='tutorial.login.logout') config.add_route('view_page', '/:pagename', view='tutorial.views.view_page', view_renderer='tutorial:templates/view.pt') @@ -38,11 +44,6 @@ def app(global_config, **settings): view='tutorial.views.edit_page', view_renderer='tutorial:templates/edit.pt', view_permission='edit') - config.add_route('login', '/login', - view='tutorial.login.login', - view_renderer='tutorial:templates/login.pt') - config.add_route('logout', '/logout', - view='tutorial.login.loout') config.add_view('tutorial.login.login', renderer='tutorial:templates/login.pt', context='pyramid.exceptions.Forbidden') -- cgit v1.2.3