Using Pylons verson 1.0: Working on a FormDemo example from a Pylons book:
http://pylonsbook.com/en/1.1/working-with-forms-and-validators.html
My controller has the following functions:
class FormtestController(BaseController):
def form(self):
return render('/simpleform.html')
def submit(self):
h.redirect_to(controller='formtest', action='result')
def result(self):
return 'Your data was successfully submitted.'
At first, I noticed that in the book, the author points to the redirect_to import to perform the following import:
from pylons.controllers.util import redirect_to
This seems wrong, since redirect_to lives in the routes module, so I changed it to this:
from routes import redirect_to
everything works fine, the import error no longer occurs, but when I submit the form, I see the following trace
h.redirect_to(controller='formtest', action='result')
target = url_for(*args, **kargs)
encoding = config.mapper.encoding
return getattr(self.__shared_state, name)
AttributeError: 'thread._local' object has no attribute 'mapper'
Can anybody help me?
source
share