Error !

AttributeError: 'NoneType' object has no attribute 'val'

<%def name="renderListItem(item, showdate=None)"> <div class="item"> % if item.val('mainimage.file'): <figure class="image"> <a href="${ item.url() }"> <img src="${ item.val('mainimage.file') }/listimg" alt="${ item.val('mainimage.title') or item.val('title') }"/> </a> </figure>
templates/mareano/partials, line 19:
% if item.val('mainimage.file'):
templates/mareano/article, line 247:
${ partials.renderListItem(item, showdate='1') }
templates/mareano/site, line 113:
${self.main_content()}
/var/limecms/mareano/mareano02/lib/python2.6/site-packages/Mako-1.0.4-py2.6.egg/mako/runtime.py, line 890:
callable_(context, *args, **kwargs)
/var/limecms/mareano/mareano02/lib/python2.6/site-packages/Mako-1.0.4-py2.6.egg/mako/runtime.py, line 864:
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
/var/limecms/mareano/mareano02/lib/python2.6/site-packages/Mako-1.0.4-py2.6.egg/mako/runtime.py, line 829:
**_kwargs_for_callable(callable_, data))
/var/limecms/mareano/mareano02/lib/python2.6/site-packages/Mako-1.0.4-py2.6.egg/mako/template.py, line 445:
return runtime._render(self, self.callable_, args, data)
/var/limecms/mareano/mareano02/mareano-inst-2/Products/LimeTemplate/LimeTemplate.py, line 702:
html = mytemplate.render(object=object, site=site, request=self.REQUEST, extra=extra.get('kwargs', None), **extra)