Error !

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

<% _img = object.get(object.val('mainimagelabel.sql')) %> % if _img.val('embed') : ${_img.val('embed')} % else: <img alt="${_img.val('title')}" src="${object.val('mainimagelabel.file')}" title="${object.val('mainimagelabel.text')}"/> % if _img.val('description'): <div class="imagelabel"><p>${_img.val('description')}</p></div>
templates/nmhresp/prosjekt, line 107:
% if _img.val('embed') :
templates/nmhresp/site, line 231:
${self.main_content()}
/var/limecms/nmh/nmh01/lib/python2.6/site-packages/mako/runtime.py, line 890:
callable_(context, *args, **kwargs)
/var/limecms/nmh/nmh01/lib/python2.6/site-packages/mako/runtime.py, line 864:
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
/var/limecms/nmh/nmh01/lib/python2.6/site-packages/mako/runtime.py, line 829:
**_kwargs_for_callable(callable_, data))
/var/limecms/nmh/nmh01/lib/python2.6/site-packages/mako/template.py, line 445:
return runtime._render(self, self.callable_, args, data)
/var/limecms/nmh/nmh01/nmh-inst-02/Products/LimeTemplate/LimeTemplate.py, line 702:
html = mytemplate.render(object=object, site=site, request=self.REQUEST, extra=extra.get('kwargs', None), **extra)