'Dispatch requests - this method is called by the controller.
@param attr: keyword arguments from the controller
@keyword _id: the node ID for the dashboard (default: "dashboard")
@return: the output for the view'

def __call__(self, **attr):

    context = self.context
    agent_id = context.agent
    http = context.http
    command = context.command
    (status, msg) = (None, None)
    if (agent_id or command or (http != 'GET')):
        request_version = context.get_vars.get('version')
        if (not request_version):
            context.error(400, current.T('Invalid    Request    URL    (version    key    missing)'))
        if (request_version != self.config.version):
            context.error(409, current.T('Page    configuration    has    changed,    please    reload    the    page'), _next=URL(args=[], vars={}))
    if (not agent_id):
        if (http == 'GET'):
            if command:
                (output, error) = self.do(command, context)
                if error:
                    (status, msg) = error
            elif (context.representation == 'html'):
                output = self.build(**attr)
            else:
                (status, msg) = (415, current.ERROR.BAD_FORMAT)
        elif (http == 'POST'):
            if command:
                (output, error) = self.do(command, context)
                if error:
                    (status, msg) = error
            else:
                (status, msg) = (405, current.ERROR.BAD_METHOD)
        else:
            (status, msg) = (405, current.ERROR.BAD_METHOD)
    elif context.bulk:
        (status, msg) = (501, current.ERROR.NOT_IMPLEMENTED)
    else:
        agent = self.agents.get(agent_id)
        if agent:
            (output, error) = agent(self, context)
            if error:
                (status, msg) = error
        else:
            (status, msg) = (404, current.ERROR.BAD_RESOURCE)
    if status:
        context.error(status, msg)
    else:
        return output
