Pylons: ‘module’ object has no attribute ‘redirect_to’

Yeah I’m using python/pylons, don’t you worry about it.

So ran into this while looking over a pylons tutorial.  Turns out, that method was removed in Pylons 1.0 but the tutorial was a little bit old. So instead of:

  redirect_to(controller='hello', action='other_action', _code=303)

just use:

  from pylons import url
  from pylons.controllers.util import abort, redirect

  ...

  redirect(url(controller='hello', action='index', _code='303'))

Bad news is I didn’t get a chance to actually see the full behavior of the old redirect to, so I’m not sure the result:

  http://127.0.0.1:5000/?_code=303

Is the same. Still new to this thing called pylons. Just got annoyed trying to find an answer to this one so hopefully my title will speed up the search for future people.

One thought on “Pylons: ‘module’ object has no attribute ‘redirect_to’”

Comments are closed.