示例#1
0
"""
import re
from flask import Blueprint, g
from bson import ObjectId

# Imports inside bombolone
import model.pages
from core.utils import ensure_objectid
from decorators import check_rank, get_hash
from core.languages import Languages
from core.validators import CheckValue

MODULE_DIR = 'modules/pages'
pages = Blueprint('pages', __name__)

check = CheckValue()  # Check Value class
languages_object = Languages()


class Pages(object):
    """ This class allows to :
    - get_page
    - reset
    - new
    - remove
    """

    page = {}
    type_label = {}
    len_of_label = 0
示例#2
0
from pymongo.errors import InvalidId, PyMongoError

# Imports from Bombolone's Core
from core.utils import jsonify, ensure_objectid
from core.languages import Languages
from core.validators import CheckValue
from core.admin.hash_table import HashTable, hash_table_list, hash_table_get

# Imports inside Bombolone
from config import LIST_LANGUAGES
from decorators import check_token, check_token_post, check_rank, get_hash, jsonp

hash_table_api = Blueprint('hash_table_api', __name__)

languages_object = Languages()
check = CheckValue()


@hash_table_api.route('/api/hash_table/list.json')
@check_token
@check_rank(20)
@get_hash('hash_table')
@jsonp
def overview():
    """ List all the documents, each has a name 
    that identifies it, and an hash map. """
    hash_map_list = hash_table_list()
    data = {"success": True, "hash_map_list": hash_map_list}
    return jsonify(data)