Sunday, July 18, 2010

AttributeError: 'thread._local' object has no attribute 'mapper'

If you are seen this error when trying to use routes.url_for, its because as of Pylons 1.0, routes.url_for as been depreciated. You should now be using pylons.url() instead.

To fix this problem in a controller or template, do the following

1) in ./lib/helpers.py:

from pylons import url

2) replace all h.url_for() with h.url()

Your problem should go away.

2 comments:

  1. Awesome thank you! I've been tearing my hair out here trying to figure that out.

    ReplyDelete
  2. thanks, its very very helpful for me.

    deniz.

    ReplyDelete