Example #1
0
def template(template_id):
    """
    Returns an existing template
    
    Args:
        template_id - int - The ID of the Template
    """
    template = Template.get_by_id(template_id)
    if not template or template.owner_domain != g.domain:
        return json_error(404, 'Template not found', {})
    return jsonify(template.to_dict())
Example #2
0
def delete_template(template_id):
    '''
    Deletes and existing template

    Args:
        template_id - int - the ID of the Template
    '''
    template = Template.get_by_id(template_id)
    if not template or template.owner_domain != g.domain:
        return json_error(404, 'Template not found', {})
    template.key.delete()
    return jsonify({'success': True, 'error': None, 'data': {}})