@handle_response_format
@treeio_login_required
def index(request, response_format='html'):
    "Homepage"
    trash = Object.filter_by_request(request, manager=Object.objects.filter(trash=True),
                                     mode='r', filter_trash=False).count()
    user = request.user.profile
    perspective = user.get_perspective()
    widget_objects = Widget.objects.filter(user=user, perspective=perspective)
    clean_widgets = []

    for widget_object in widget_objects:
        try:
            module = perspective.get_modules().filter(
                name=widget_object.module_name)[0]
            widget = _get_widget(request, module, widget_object.widget_name)
            if 'view' in widget:
                try:
                    content = unicode(
                        widget['view'](request, response_format=response_format).content, 'utf_8')
                    widget_content = _get_widget_content(
                        content, response_format=response_format)
                except Exception, e:
                    widget_content = ""
                    if settings.DEBUG:
                        widget_content = str(e)

                widget['content'] = widget_content
            if widget:
                widget_object.widget = widget
                clean_widgets.append(widget_object)
        except __HOLE__:
            widget_object.delete()

    return render_to_response('core/dashboard/index',
                              {'trash': trash,
                               'widgets': clean_widgets},
                              context_instance=RequestContext(request), response_format=response_format)
dataset/ETHPy150Open treeio/treeio/treeio/core/dashboard/views.py/index