diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst index 3f6df17de0..da76f3ec77 100644 --- a/docs/quick_tutorial/authentication.rst +++ b/docs/quick_tutorial/authentication.rst @@ -137,7 +137,7 @@ Subsequent requests return that cookie and identify the user. In our template, we fetched the ``logged_in`` value from the view class. We use this to calculate the logged-in user, if any. In the template we can then choose to show a login link to anonymous visitors or a logout link to logged-in -users. +users, including their login name. Extra credit diff --git a/docs/quick_tutorial/authentication/tutorial/home.pt b/docs/quick_tutorial/authentication/tutorial/home.pt index ed911b6739..0e8508558b 100644 --- a/docs/quick_tutorial/authentication/tutorial/home.pt +++ b/docs/quick_tutorial/authentication/tutorial/home.pt @@ -8,8 +8,10 @@
Log In - Logout + + Logout + as ${view.logged_in} +

Hi ${name}

diff --git a/docs/quick_tutorial/authentication/tutorial/login.pt b/docs/quick_tutorial/authentication/tutorial/login.pt index 9e5bfe2ad6..db8080fc88 100644 --- a/docs/quick_tutorial/authentication/tutorial/login.pt +++ b/docs/quick_tutorial/authentication/tutorial/login.pt @@ -8,8 +8,6 @@
- Log In - Logout + + Logout + as ${view.logged_in} +

Hi ${name}

diff --git a/docs/quick_tutorial/authorization/tutorial/login.pt b/docs/quick_tutorial/authorization/tutorial/login.pt index 9e5bfe2ad6..db8080fc88 100644 --- a/docs/quick_tutorial/authorization/tutorial/login.pt +++ b/docs/quick_tutorial/authorization/tutorial/login.pt @@ -8,8 +8,6 @@ - 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()} -
-
    -
  • - ${structure:error} -
  • -
-
- - - - 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