Ejemplo n.º 1
0
def create_extra_admin_user(email, name, password):
    "Initializes the administrator of the platform"
    from werkzeug import generate_password_hash
    print("Creation of the admin user...")
    with app.app_context():
        user = web.models.User(email=email,
                            name=name,
                            pwdhash=generate_password_hash(password),
                            is_admin=True,
                            is_active=True)
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 2
0
def create_admin_user():
    "Initializes the administrator of the platform"
    from werkzeug import generate_password_hash
    print("Creation of the admin user...")
    with app.app_context():
        user = web.models.User(email=conf.ADMIN_EMAIL,
                            name=conf.ADMIN_NAME,
                            pwdhash=generate_password_hash(conf.ADMIN_PASSWORD),
                            is_admin=True,
                            is_active=True)
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 3
0
def create_extra_admin_user(email, name, password):
    "Initializes the administrator of the platform"
    from werkzeug import generate_password_hash
    print("Creation of the admin user...")
    with app.app_context():
        user = web.models.User(email=email,
                               name=name,
                               pwdhash=generate_password_hash(password),
                               is_admin=True,
                               is_active=True)
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 4
0
def create_admin_user():
    "Initializes the administrator of the platform"
    from werkzeug import generate_password_hash
    print("Creation of the admin user...")
    with app.app_context():
        user = web.models.User(email="*****@*****.**",
                               name="admin",
                               pwdhash=generate_password_hash("password"),
                               is_admin=True,
                               is_active=True)
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 5
0
def create_admin_user():
    "Initializes the administrator of the platform"
    from werkzeug import generate_password_hash
    print("Creation of the admin user...")
    with app.app_context():
        user = web.models.User(email=conf.ADMIN_EMAIL,
                               name=conf.ADMIN_NAME,
                               pwdhash=generate_password_hash(
                                   conf.ADMIN_PASSWORD),
                               is_admin=True,
                               is_active=True)
        db.session.add(user)
        db.session.commit()
Ejemplo n.º 6
0
def init_shelters_structure(csv_file, drawnings_folder):
    "Will initialize the database with the attribute for the shelters."
    print(
        "Importing base structure of shelters from '{}' ...".format(csv_file))
    with app.app_context():
        scripts.init_shelters_structure(csv_file, drawnings_folder)
Ejemplo n.º 7
0
def create_db_triggers():
    "Creates triggers and trigger functions for tables"
    print("Creating database triggers ...")
    with app.app_context():
        scripts.create_db_triggers()
Ejemplo n.º 8
0
def export_shelters_pictures(dump_dir, foldername):
    "Exports shelters pictures into a directory tree"
    print("Exporting shelter picture directories ...")
    with app.app_context():
        scripts.export_shelters_pictures(dump_dir, foldername)
Ejemplo n.º 9
0
def db_empty():
    "Will drop the database."
    print("Dropping database...")
    with app.app_context():
        populate_g()
        web.models.db_empty(db)
Ejemplo n.º 10
0
def import_shelters_documents(folder):
    "Import documents for shelters"
    print("Importing documents from '{}' ...".format(folder))
    with app.app_context():
        scripts.import_shelters_documents(folder)
Ejemplo n.º 11
0
def create_shelters_thumbnails():
    "Creates thumbnails of the cover pictures of shelters"
    print("Creating shelter picture thumbnails ...")
    with app.app_context():
        scripts.create_shelters_thumbnails()
Ejemplo n.º 12
0
def db_init():
    "Will initialize the database."
    print("Initialization of the database...")
    with app.app_context():
        populate_g()
        web.models.db_init(db)
Ejemplo n.º 13
0
def import_translation(translation_file, language_code):
    "Import a translation file in the database"
    print("Importing translation file from '{}' ...".format(translation_file))
    with app.app_context():
        scripts.import_translation(translation_file, language_code)
Ejemplo n.º 14
0
def uml_graph():
    "UML graph from the models."
    with app.app_context():
        web.models.uml_graph(db)
Ejemplo n.º 15
0
def db_empty():
    "Will drop the database."
    print("Dropping database...")
    with app.app_context():
        populate_g()
        web.models.db_empty(db)
Ejemplo n.º 16
0
def export_shelters_pictures(dump_dir, foldername):
    "Exports shelters pictures into a directory tree"
    print("Exporting shelter picture directories ...")
    with app.app_context():
        scripts.export_shelters_pictures(dump_dir, foldername)
Ejemplo n.º 17
0
def export_shelters(dump_file, truncate):
    "Exports shelters as a CSV dump file"
    print("Exporting shelter data ...")
    with app.app_context():
        scripts.export_shelters(dump_file, truncate)
Ejemplo n.º 18
0
def create_shelters_thumbnails():
    "Creates thumbnails of the cover pictures of shelters"
    print("Creating shelter picture thumbnails ...")
    with app.app_context():
        scripts.create_shelters_thumbnails()
Ejemplo n.º 19
0
def import_shelters(shelters_owner, csv_file):
    "Will import the shelters in the database."
    print("Importing shelters from '{}' ...".format(csv_file))
    with app.app_context():
        scripts.populate_shelters(shelters_owner, csv_file)
Ejemplo n.º 20
0
def init_shelters_structure(csv_file, drawnings_folder):
    "Will initialize the database with the attribute for the shelters."
    print("Importing base structure of shelters from '{}' ...".format(csv_file))
    with app.app_context():
        scripts.init_shelters_structure(csv_file, drawnings_folder)
Ejemplo n.º 21
0
def import_page(name, html_file, language_code):
    "Import a page (HTML file) in the database"
    print("Importing page from '{}' ...".format(html_file))
    with app.app_context():
        scripts.init_page(name, html_file, language_code)
Ejemplo n.º 22
0
def import_shelters_pictures(folder):
    "Import pictures for shelters"
    print("Importing pictures from '{}' ...".format(folder))
    with app.app_context():
        scripts.import_shelters_pictures(folder)
Ejemplo n.º 23
0
def import_shelters_pictures(folder):
    "Import pictures for shelters"
    print("Importing pictures from '{}' ...".format(folder))
    with app.app_context():
        scripts.import_shelters_pictures(folder)
Ejemplo n.º 24
0
def import_translation(translation_file, language_code):
    "Import a translation file in the database"
    print("Importing translation file from '{}' ...".format(translation_file))
    with app.app_context():
        scripts.import_translation(translation_file, language_code)
Ejemplo n.º 25
0
def create_db_triggers():
    "Creates triggers and trigger functions for tables"
    print("Creating database triggers ...")
    with app.app_context():
        scripts.create_db_triggers()
Ejemplo n.º 26
0
def db_create():
    "Will create the database."
    print("Creation of the database...")
    with app.app_context():
        populate_g()
        web.models.db_create(db)
Ejemplo n.º 27
0
def export_shelters(dump_file, truncate):
    "Exports shelters as a CSV dump file"
    print("Exporting shelter data ...")
    with app.app_context():
        scripts.export_shelters(dump_file, truncate)
Ejemplo n.º 28
0
def import_page(name, html_file, language_code):
    "Import a page (HTML file) in the database"
    print("Importing page from '{}' ...".format(html_file))
    with app.app_context():
        scripts.init_page(name, html_file, language_code)
Ejemplo n.º 29
0
def uml_graph():
    "UML graph from the models."
    with app.app_context():
        web.models.uml_graph(db)
Ejemplo n.º 30
0
def import_shelters(shelters_owner, csv_file):
    "Will import the shelters in the database."
    print("Importing shelters from '{}' ...".format(csv_file))
    with app.app_context():
        scripts.populate_shelters(shelters_owner, csv_file)
Ejemplo n.º 31
0
def db_init():
    "Will initialize the database."
    print("Initialization of the database...")
    with app.app_context():
        populate_g()
        web.models.db_init(db)
Ejemplo n.º 32
0
def create_user(email, name, password):
    "Initializes a user"
    print("Creation of the user {} ...".format(name))
    with app.app_context():
        scripts.create_user(email, name, password)
Ejemplo n.º 33
0
#
#
#
# ***** END LICENSE BLOCK *****

__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__date__ = "$Date: 2016/03/30 $"
__revision__ = "$Date: 2016/08/07 $"
__copyright__ = "Copyright (c) "
__license__ = ""

from bootstrap import conf, app, populate_g
import os

with app.app_context():
    populate_g()

    # HTML views
    from web import views
    app.register_blueprint(views.user_bp)
    app.register_blueprint(views.shelter_bp)
    app.register_blueprint(views.shelters_bp)
    app.register_blueprint(views.admin_bp)

    # API v0.1
    app.register_blueprint(views.api.blueprint_user)
    app.register_blueprint(views.api.blueprint_shelter)
    app.register_blueprint(views.api.blueprint_shelter_picture)
    app.register_blueprint(views.api.blueprint_section)
    app.register_blueprint(views.api.blueprint_category)
Ejemplo n.º 34
0
def import_shelters_documents(folder):
    "Import documents for shelters"
    print("Importing documents from '{}' ...".format(folder))
    with app.app_context():
        scripts.import_shelters_documents(folder)
Ejemplo n.º 35
0
# All rights reserved.
#
#
#
# ***** END LICENSE BLOCK *****

__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__date__ = "$Date: 2016/03/30 $"
__revision__ = "$Date: 2016/08/07 $"
__copyright__ = "Copyright (c) "
__license__ = ""

from bootstrap import conf, app, populate_g

with app.app_context():
    populate_g()

    # HTML views
    from web import views
    app.register_blueprint(views.user_bp)
    app.register_blueprint(views.shelter_bp)
    app.register_blueprint(views.shelters_bp)
    app.register_blueprint(views.admin_bp)

    # API v0.1
    app.register_blueprint(views.api.blueprint_user)
    app.register_blueprint(views.api.blueprint_shelter)
    app.register_blueprint(views.api.blueprint_shelter_picture)
    app.register_blueprint(views.api.blueprint_section)
    app.register_blueprint(views.api.blueprint_category)
Ejemplo n.º 36
0
def create_user(email, name, password):
    "Initializes a user"
    print("Creation of the user {} ...".format(name))
    with app.app_context():
        scripts.create_user(email, name, password)