示例#1
0
def scheming_group_schema_show(context, data_dict):
    '''
    Return the scheming schema for a given group type

    :param type: the group type
    :param expanded: True to expand presets (default)
    '''
    t = get_or_bust(data_dict, 'type')
    expanded = data_dict.get('expanded', True)
    s = scheming_get_group_schema(t, expanded)
    if s is None:
        raise ObjectNotFound()
    return s
示例#2
0
def scheming_organization_schema_show(context, data_dict):
    """
    Return the scheming schema for a given organization type

    :param type: the organization type
    :param expanded: True to expand presets (default)
    """
    t = get_or_bust(data_dict, 'type')
    expanded = data_dict.get('expanded', True)
    s = scheming_get_organization_schema(t, expanded)
    if s is None:
        raise ObjectNotFound()
    return s
示例#3
0
def validation(resource_id, id=None):
    try:
        validation = get_action(u'resource_validation_show')(
            {
                u'user': c.user
            }, {
                u'resource_id': resource_id
            })

        resource = get_action(u'resource_show')({
            u'user': c.user
        }, {
            u'id': resource_id
        })

        package_id = resource[u'package_id']
        if id and id != package_id:
            raise ObjectNotFound("Resource {} not found in package {}".format(
                resource_id, id))

        dataset = get_action(u'package_show')(
            {
                u'user': c.user
            }, {
                u'id': id or resource[u'package_id']
            })

        # Needed for core resource templates
        c.package = c.pkg_dict = dataset
        c.resource = resource

        return render(u'validation/validation_read.html',
                      extra_vars={
                          u'validation': validation,
                          u'resource': resource,
                          u'pkg_dict': dataset,
                          u'dataset': dataset,
                      })

    except NotAuthorized:
        return abort(403, _(u'Unauthorized to read this validation report'))
    except ObjectNotFound:
        return abort(404, _(u'No validation report exists for this resource'))