示例#1
0
def group_show(context, data_dict):
    '''
        Warning: This API request is deprecated. Please use the equivalent one
        on version 3 of the API:
        http://iatiregistry.org/api/action/organization_show
    '''
    return get_core.group_show(context, data_dict)
示例#2
0
def publisher_show(context, data_dict):
    """Shows publisher details.
    Based on group_show, but has parent group, as well as the child groups.

    May raise NotFound or NotAuthorized.
    """
    group_dict = group_show(context, data_dict)

    model = context["model"]
    id = get_or_bust(data_dict, "id")
    group = model.Group.get(id)

    parent_groups = publisher_lib.get_parents(group)
    group_dict["parent_group"] = parent_groups[0].name if parent_groups else None

    return group_dict
示例#3
0
def publisher_show(context, data_dict):
    '''Shows publisher details.
    Based on group_show, but has parent group, as well as the child groups.

    May raise NotFound or NotAuthorized.
    '''
    group_dict = group_show(context, data_dict)

    model = context['model']
    id = get_or_bust(data_dict, 'id')
    group = model.Group.get(id)

    parent_groups = publisher_lib.get_parents(group)
    group_dict['parent_group'] = {'id': parent_groups[0].id, 'name': parent_groups[0].name} \
                                 if parent_groups else None

    return group_dict
示例#4
0
    def edit(self, id, data=None, errors=None, error_summary=None):
        context = {'model': model, 'session': model.Session,
                   'user': c.user or c.author, 'extras_as_string': True,
                   'save': 'save' in request.params,
                   'schema': self._form_to_db_schema(),
                   }
        data_dict = {'id': id}

        if context['save'] and not data:
            return self._save_edit(id, context)

        try:
            old_data = get.group_show(context, data_dict)
            c.grouptitle = old_data.get('title')
            c.groupname = old_data.get('name')
            schema = self._db_to_form_schema()
            if schema:
                old_data, errors = validate(old_data, schema)

            data = data or old_data

        except NotAuthorized:
            abort(401, _('Unauthorized to read group %s') % '')

        group = context.get("group")

        am_authz = self.authorizer.am_authorized(c, model.Action.EDIT, group)
        if not am_authz:
            abort(401, _('User %r not authorized to edit %s') % (c.user, id))

        errors = errors or {}
        vars = {'data': data, 'errors': errors, 'error_summary': error_summary}

        self._setup_template_variables(context)
        c.form = render(self.group_form, extra_vars=vars)
        return render('group/edit.html')
示例#5
0
def group_show(context, data_dict):
    """Limit packages returned with groups"""
    context.update({'limits': {'packages': 2}})
    return core_get.group_show(context, data_dict)
示例#6
0
def group_show(context, data_dict):

    context.update({'limits': {'packages': 2}})

    return core_get.group_show(context, data_dict)
示例#7
0
def group_show(context, data_dict):

    context.update({'limits': {'packages': 2}})

    return core_get.group_show(context, data_dict)
示例#8
0
def group_show(context, data_dict):
    """Limit packages returned with groups"""
    context.update({'limits': {'packages': 2}})
    return core_get.group_show(context, data_dict)