示例#1
0
def template_delete(oauth_request, template_id, extension):

    Template_ = Template()
    Template_.current_user = oauth_request.user
    deleted_template = Template_.template_delete(template_id)

    if type(deleted_template) is tuple:
        return deleted_template

    return status_.status_204(), 204
示例#2
0
def template_post(oauth_request, application_id, extension):

    Template_ = Template()
    Template_.current_user = oauth_request.user
    new_template = Template_.template_create(request, application_id)

    if type(new_template) is tuple:
        return new_template

    arguments = {"the_content": new_template, "extension": extension, "code": 201}

    return Template_.endpoint_response(**arguments)
示例#3
0
def application_update(oauth_request, template_id, extension):

    Template_ = Template()
    Template_.current_user = oauth_request.user
    updated_template = Template_.template_update(template_id, request)

    if type(updated_template) is tuple:
        return updated_template

    arguments = {"the_content": updated_template, "extension": extension}

    return Template_.endpoint_response(**arguments)
示例#4
0
def template_activity(oauth_request, template_id, extension, is_public):

    Template_ = Template()
    Template_.current_user = oauth_request.user
    this_activity = Template_.template_activity(template_id)

    if type(this_activity) is tuple:
        return this_activity

    arguments = {"the_content": this_activity, "list_name": "activities", "extension": extension}

    return Template_.endpoint_response(**arguments)
示例#5
0
def template_get(oauth_request, template_id, extension, is_public):

    Template_ = Template()
    Template_.current_user = oauth_request.user
    this_template = Template_.template_get(template_id, is_public)

    if type(this_template) is tuple:
        return this_template

    arguments = {"the_content": this_template, "extension": extension}

    return Template_.endpoint_response(**arguments)
示例#6
0
def application_templates_get(oauth_request, application_id, extension, is_public):

    Template_ = Template()
    Template_.current_user = oauth_request.user

    these_templates = Template_.application_templates_get(application_id, is_public)

    if type(these_templates) is tuple:
        return these_templates

    arguments = {"the_content": these_templates, "list_name": "templates", "extension": extension}

    return Template_.endpoint_response(**arguments)