Permalink
Browse files

merge backout of 5ffbb270c8a3

--HG--
branch : 0.10
  • Loading branch information...
2 parents 97031a2 + c291c63 commit 12de02baf7789566756c827b853b66d7bc464048 @pjenvey pjenvey committed Jan 19, 2010
@@ -40,7 +40,7 @@ To trigger an error so that we can explore what's happening just raise an except
class DocsController(BaseController):
def view(self, url):
if request.path_info.endswith('docs'):
- redirect_to('/docs/')
+ redirect(url('/docs/'))
return render('/docs/' + url)
Since we want to explore the ``session`` and ``request``, we'll need to bind them first. Here's what our action now looks like with the binding and raising an exception:
@@ -50,7 +50,7 @@ Since we want to explore the ``session`` and ``request``, we'll need to bind the
def view(self, url):
raise "hi"
if request.path_info.endswith('docs'):
- redirect_to('/docs/')
+ redirect(url('/docs/'))
return render('/docs/' + url)
Here's what exploring the Traceback from the above example looks like (Excerpt of the relevant portion):
View
@@ -68,7 +68,7 @@ Of course, the best way to solve this issue is to structure your code differentl
def email(self):
# Code to perform some action based on the form data
# ...
- redirect_to(action='result')
+ redirect(url(action='result'))
def result(self):
return 'Your data was successfully submitted'
@@ -197,8 +197,8 @@ The default controller will return just the string 'Hello World':
import logging
- from pylons import request, response, session, tmpl_context as c
- from pylons.controllers.util import abort, redirect_to
+ from pylons import request, response, session, tmpl_context as c, url
+ from pylons.controllers.util import abort, redirect
from helloworld.lib.base import BaseController, render
@@ -18,8 +18,8 @@ For example, in the helloworld project's hello controller
import logging
- from pylons import request, response, session, tmpl_context as c
- from pylons.controllers.util import abort, redirect_to
+ from pylons import request, response, session, tmpl_context as c, url
+ from pylons.controllers.util import abort, redirect
log = logging.getLogger(__name__)
@@ -37,8 +37,8 @@ To log messages, simply use methods available on that Logger object:
import logging
- from pylons import request, response, session, tmpl_context as c
- from pylons.controllers.util import abort, redirect_to
+ from pylons import request, response, session, tmpl_context as c, url
+ from pylons.controllers.util import abort, redirect
log = logging.getLogger(__name__)
View
@@ -73,8 +73,8 @@ To pass objects to templates, the standard Pylons method is to attach them to th
import logging
- from pylons import request, response, session, tmpl_context as c
- from pylons.controllers.util import abort, redirect_to
+ from pylons import request, response, session, tmpl_context as c, url
+ from pylons.controllers.util import abort, redirect
from helloworld.lib.base import BaseController, render

0 comments on commit 12de02b

Please sign in to comment.