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()
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()
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #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)
def create_db_triggers():
    "Creates triggers and trigger functions for tables"
    print("Creating database triggers ...")
    with app.app_context():
        scripts.create_db_triggers()
Exemple #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)
Exemple #9
0
def db_empty():
    "Will drop the database."
    print("Dropping database...")
    with app.app_context():
        populate_g()
        web.models.db_empty(db)
Exemple #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)
Exemple #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()
Exemple #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)
Exemple #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)
Exemple #14
0
def uml_graph():
    "UML graph from the models."
    with app.app_context():
        web.models.uml_graph(db)
Exemple #15
0
def db_empty():
    "Will drop the database."
    print("Dropping database...")
    with app.app_context():
        populate_g()
        web.models.db_empty(db)
Exemple #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)
Exemple #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)
Exemple #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()
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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()
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #29
0
def uml_graph():
    "UML graph from the models."
    with app.app_context():
        web.models.uml_graph(db)
Exemple #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)
Exemple #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)
Exemple #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)
#
#
#
# ***** 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)
Exemple #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)
# 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)
Exemple #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)