'Get the configuration for the requested report, updated
with URL options'

def get_report_config(self):

    r = self.request
    get_vars = r.get_vars
    config = self.resource.get_config('grouped')
    if (not config):
        r.error(405, current.ERROR.NOT_IMPLEMENTED)
    report = get_vars.get('report', 'default')
    if isinstance(report, list):
        report = report[(-1)]
    report_config = config.get(report)
    if (not report_config):
        r.error(405, current.ERROR.NOT_IMPLEMENTED)
    else:
        report_config = dict(report_config)
    orderby = get_vars.get('orderby')
    if isinstance(orderby, list):
        orderby = ','.join(orderby).split(',')
    if (not orderby):
        orderby = report_config.get('orderby')
    if (not orderby):
        orderby = report_config.get('groupby')
    report_config['orderby'] = orderby
    return report_config
