Pylons

AttributeError: 'thread._local' object has no attribute 'mapper' (comments)

Jul 2, 2010 9:04:04 AM by Kyoku57
  • weberror.evalexception : 431, in respond

    app_iter = self.application(environ, detect_start_response)
    
  • beaker.middleware : 152, in __call__

    return self.wrap_app(environ, session_start_response)
    
  • routes.middleware : 131, in __call__

    response = self.app(environ, start_response)
    
  • pylons.wsgiapp : 107, in __call__

    response = self.dispatch(controller, environ, start_response)
    
  • pylons.wsgiapp : 312, in dispatch

    return controller(environ, start_response)
    
  • simplesite.lib.base : 18, in __call__

    return WSGIController.__call__(self, environ, start_response)
    
  • pylons.controllers.core : 211, in __call__

    response = self._dispatch_call()
    
  • pylons.controllers.core : 162, in _dispatch_call

    response = self._inspect_call(func)
    
  • pylons.controllers.core : 105, in _inspect_call

    result = self._perform_call(func, args)
    
  • pylons.controllers.core : 57, in _perform_call

    return func(**args)
    
  • simplesite.controllers.page : 99, in list

    return render('/derived/page/list.html')
    
  • pylons.templating : 243, in render_mako

    cache_type=cache_type, cache_expire=cache_expire)
    
  • pylons.templating : 218, in cached_template

    return render_func()
    
  • pylons.templating : 240, in render_template

    return literal(template.render_unicode(**globs))
    
  • mako.template : 198, in render_unicode

    as_unicode=True)
    
  • mako.runtime : 403, in _render

    _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
    
  • mako.runtime : 434, in _render_context

    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
    
  • mako.runtime : 452, in _exec_template

    _render_error(template, context, e)
    
  • mako.runtime : 462, in _render_error

    result = template.error_handler(context, error)
    
  • mako.runtime : 450, in _exec_template

    callable_(context, *args, **kwargs)
    
  • _base_index_html : 47, in render_body

    __M_writer(escape(next.body()))
    
  • mako.runtime : 278, in <lambda>

    return lambda *args, **kwargs:callable_(self.context, *args, **kwargs)
    
  • _derived_page_list_html : 47, in render_body

    __M_writer(escape( c.paginator.pager('$link_first $link_previous $first_item to $last_item of $item_count $link_next $link_last') ))
    
  • webhelpers.paginate : 703, in pager

    _pagerlink(self.last_page, symbol_last) or '',
    
  • webhelpers.paginate : 597, in _pagerlink

    link_url = url_for(**link_params)
    
  • routes.util : 189, in url_for

    encoding = config.mapper.encoding
    
  • routes : 14, in __getattr__

    return getattr(self.__shared_state, name)
    
AttributeError: 'thread._local' object has no attribute 'mapper'

Description

No Description Entered

Python on : 2.6.5
beaker1.5.4
decorator3.2.0
formencode1.2.2
mako0.3.4
markupsafe0.9.2
nose0.11.3
paste1.7.4
pastedeploy1.3.3
pastescript1.7.3
pygments1.3.1
pylons1.0
routes1.12.3
simplejson2.1.1
sqlalchemy0.5.8
tempita0.4
weberror0.10.2
webhelpers0.6.4
webob0.9.8
webtest1.2.1

Comments (7)

Kyoku57
Jul 2, 2010 9:07:38 AM

Hi everyone,

I’m stopped on pagination on the wonderful tutorial : http://pylonsbook.com/en/1.1/starting-the-simplesite-tutorial.html#using-pagination

I try to made the tutorial and adapt it when I can. The first problem I had is link to routes.url_for seems to be depreced and return me lot of mapper problems. I changed all my h.url_for by url… but it seems to be used to in import webhelpers.paginate as paginate

if someone have an idea…

Thanks

Kyoku57
Jul 2, 2010 12:12:52 PM

After reading : http://pylonshq.com/docs/en/1.0/thirdparty/webhelpers/paginate/

I had in my controller ‘page’ action=‘list’:
mapper = Mapper()
mapper.connect(’/page/list’)

Exemple :
def list(self):
mapper = Mapper()
mapper.connect(’/page/list’)

records = model.meta.Session.query(model.Page)
c.paginator = paginate.Page(
records,
page=int(request.params.get(‘page’, 1)),
items_per_page = 5,
)
return render(’/derived/page/list.html’)

It’s work, but I’m sure that there is a proper way, no ?

Kyoku57
Jul 2, 2010 2:44:49 PM

Perhaps with herit webhelpers.pagination and change all reference to url_for by pylons.url ?

tjelvar
Jul 20, 2010 7:11:04 AM

Thank you!

Suggest a fix or tip to help solve this traceback.

You must login before you can comment.

Powered by Pylons - Contact Administrators