Skip to content

Commit

Permalink
Merge pull request Pylons#687 from ppaez/tutcodefix
Browse files Browse the repository at this point in the history
Complete changes for issue Pylons#652
  • Loading branch information
ppaez committed Sep 11, 2012
2 parents dc8b49f + a3ed618 commit 68f83b1
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
10 changes: 5 additions & 5 deletions docs/tutorials/wiki/src/authorization/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ def check(match):
renderer='templates/edit.pt',
permission='edit')
def add_page(context, request):
name = request.subpath[0]
pagename = request.subpath[0]
if 'form.submitted' in request.params:
body = request.params['body']
page = Page(body)
page.__name__ = name
page.__name__ = pagename
page.__parent__ = context
context[name] = page
context[pagename] = page
return HTTPFound(location = request.resource_url(page))
save_url = request.resource_url(context, 'add_page', name)
save_url = request.resource_url(context, 'add_page', pagename)
page = Page('')
page.__name__ = name
page.__name__ = pagename
page.__parent__ = context

return dict(page = page, save_url = save_url,
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorials/wiki/src/tests/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ def check(match):
renderer='templates/edit.pt',
permission='edit')
def add_page(context, request):
name = request.subpath[0]
pagename = request.subpath[0]
if 'form.submitted' in request.params:
body = request.params['body']
page = Page(body)
page.__name__ = name
page.__name__ = pagename
page.__parent__ = context
context[name] = page
context[pagename] = page
return HTTPFound(location = request.resource_url(page))
save_url = request.resource_url(context, 'add_page', name)
save_url = request.resource_url(context, 'add_page', pagename)
page = Page('')
page.__name__ = name
page.__name__ = pagename
page.__parent__ = context

return dict(page = page, save_url = save_url,
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorials/wiki/src/views/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ def check(match):
@view_config(name='add_page', context='.models.Wiki',
renderer='templates/edit.pt')
def add_page(context, request):
name = request.subpath[0]
pagename = request.subpath[0]
if 'form.submitted' in request.params:
body = request.params['body']
page = Page(body)
page.__name__ = name
page.__name__ = pagename
page.__parent__ = context
context[name] = page
context[pagename] = page
return HTTPFound(location = request.resource_url(page))
save_url = request.resource_url(context, 'add_page', name)
save_url = request.resource_url(context, 'add_page', pagename)
page = Page('')
page.__name__ = name
page.__name__ = pagename
page.__parent__ = context
return dict(page = page, save_url = save_url)

Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/wiki2/src/authorization/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,31 @@ def check(match):
@view_config(route_name='add_page', renderer='templates/edit.pt',
permission='edit')
def add_page(request):
name = request.matchdict['pagename']
pagename = request.matchdict['pagename']
if 'form.submitted' in request.params:
body = request.params['body']
page = Page(name, body)
page = Page(pagename, body)
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=name))
save_url = request.route_url('add_page', pagename=name)
pagename=pagename))
save_url = request.route_url('add_page', pagename=pagename)
page = Page('', '')
return dict(page=page, save_url=save_url,
logged_in=authenticated_userid(request))

@view_config(route_name='edit_page', renderer='templates/edit.pt',
permission='edit')
def edit_page(request):
name = request.matchdict['pagename']
page = DBSession.query(Page).filter_by(name=name).one()
pagename = request.matchdict['pagename']
page = DBSession.query(Page).filter_by(name=pagename).one()
if 'form.submitted' in request.params:
page.data = request.params['body']
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=name))
pagename=pagename))
return dict(
page=page,
save_url = request.route_url('edit_page', pagename=name),
save_url = request.route_url('edit_page', pagename=pagename),
logged_in=authenticated_userid(request),
)

Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/wiki2/src/tests/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,33 @@ def check(match):
@view_config(route_name='add_page', renderer='templates/edit.pt',
permission='edit')
def add_page(request):
name = request.matchdict['pagename']
pagename = request.matchdict['pagename']
if 'form.submitted' in request.params:
session = DBSession()
body = request.params['body']
page = Page(name, body)
page = Page(pagename, body)
session.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=name))
save_url = request.route_url('add_page', pagename=name)
pagename=pagename))
save_url = request.route_url('add_page', pagename=pagename)
page = Page('', '')
return dict(page=page, save_url=save_url,
logged_in=authenticated_userid(request))

@view_config(route_name='edit_page', renderer='templates/edit.pt',
permission='edit')
def edit_page(request):
name = request.matchdict['pagename']
pagename = request.matchdict['pagename']
session = DBSession()
page = session.query(Page).filter_by(name=name).one()
page = session.query(Page).filter_by(name=pagename).one()
if 'form.submitted' in request.params:
page.data = request.params['body']
session.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=name))
pagename=pagename))
return dict(
page=page,
save_url = request.route_url('edit_page', pagename=name),
save_url = request.route_url('edit_page', pagename=pagename),
logged_in=authenticated_userid(request),
)

Expand Down
16 changes: 8 additions & 8 deletions docs/tutorials/wiki2/src/views/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,27 @@ def check(match):

@view_config(route_name='add_page', renderer='templates/edit.pt')
def add_page(request):
name = request.matchdict['pagename']
pagename = request.matchdict['pagename']
if 'form.submitted' in request.params:
body = request.params['body']
page = Page(name, body)
page = Page(pagename, body)
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=name))
save_url = request.route_url('add_page', pagename=name)
pagename=pagename))
save_url = request.route_url('add_page', pagename=pagename)
page = Page('', '')
return dict(page=page, save_url=save_url)

@view_config(route_name='edit_page', renderer='templates/edit.pt')
def edit_page(request):
name = request.matchdict['pagename']
page = DBSession.query(Page).filter_by(name=name).one()
pagename = request.matchdict['pagename']
page = DBSession.query(Page).filter_by(name=pagename).one()
if 'form.submitted' in request.params:
page.data = request.params['body']
DBSession.add(page)
return HTTPFound(location = request.route_url('view_page',
pagename=name))
pagename=pagename))
return dict(
page=page,
save_url = request.route_url('edit_page', pagename=name),
save_url = request.route_url('edit_page', pagename=pagename),
)

0 comments on commit 68f83b1

Please sign in to comment.