Beispiel #1
0
   def __init__(self):
      script_path = dirname(realpath(__file__))
      conf = load_settings(join(script_path, 'config.ini'))

      super().__init__(conf, script_path)

      assert ctx.get_session() != None
      self.init_modules(modules, conf)
Beispiel #2
0
    def __init__(self):
        # eme/examples/simple_website is the working directory.
        script_path = dirname(realpath(__file__))
        conf = load_settings(join(script_path, 'config.ini'))

        super().__init__(conf, script_path)

        startup.init(self)
        auth.init(self, conf['auth'])
Beispiel #3
0
    def run(self):
        """
        Backup database
        """

        # todo: absolute path
        backup = load_settings('cliapp/config.ini')

        dbfile = backup['db_file']
        backupfile = backup['file']

        # backup every day (rename to current week name)
        # backup monthly
        today = datetime.today()

        shutil.copy(dbfile, backupfile.format(year=today.year, month=today.month))
Beispiel #4
0
    def __init__(self):
        # eme/examples/simple_website is the working directory.
        script_path = dirname(realpath(__file__))
        conf = load_settings(join(script_path, 'config.ini'))

        super().__init__(conf, script_path)

        self.load_controllers(load_handlers(self,
                                            'Api',
                                            module_path='api',
                                            path=join(script_path, 'api')),
                              conf=conf.get('routing', {}))

        # Initialize database & modules
        assert ctx.get_session() != None
        self.init_modules(modules, conf)
Beispiel #5
0
import os
import sys

from eme.entities import load_handlers, load_settings
from eme.website import WebsiteBlueprint

from .services import auth

module_path = os.path.dirname(os.path.realpath(__file__))
conf = load_settings(os.path.join(module_path, 'config.ini'))
sys.path.append(module_path)


blueprint = None


def init_webapp(webapp, webconf):
    # TODO: ITT: test with eme first?

    auth.init(webapp, conf['auth'])

    global blueprint

    blueprint = WebsiteBlueprint('doors', conf, module_path, module_route="/users")


def init_cliapp(app, conf):
    app.commands.update(load_handlers(app, 'Command', path=os.path.join(module_path, 'commands')))


def init_wsapp(app, conf):
Beispiel #6
0
Datei: cli.py Projekt: JobTK/eme
   def __init__(self):
      script_path = dirname(realpath(__file__))
      conf = load_settings(join(script_path, 'config.ini'))

      super().__init__(conf, script_path)
Beispiel #7
0
import redis
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, close_all_sessions

from eme import data_access
from eme.data_access import register_session
from eme.entities import load_settings

config = load_settings("core/dal/ctx.ini")
db_type = config.get('db.type')

# an Engine, which the Session will use for connection resources
if db_type == 'sqlite':
    db_engine = create_engine('sqlite:///{file}'.format(**config[db_type]),
                              connect_args={'check_same_thread': False})
else:
    if 'driver' in config[db_type]:
        db_type += '+' + config[db_type].pop('driver')
    db_engine = create_engine(db_type +
                              '://{user}:{password}@{host}/{database}'.format(
                                  **config[db_type]))

Session = sessionmaker(bind=db_engine)

db_session = Session()

register_session('db', db_session)


def set_session(sess, sessid='db'):
    global db_session
Beispiel #8
0
Datei: ctx.py Projekt: JobTK/eme
import redis

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from eme.data_access import register_session
from eme.entities import load_settings

config = load_settings("core/content/ctx.ini")
db_type = config.get('db.type')

# an Engine, which the Session will use for connection resources
if db_type == 'sqlite':
    db_engine = create_engine('sqlite:///{file}'.format(**config[db_type]),
                              connect_args={'check_same_thread': False})
else:
    if 'driver' in config[db_type]:
        db_type += '+' + config[db_type].pop('driver')
    db_engine = create_engine(db_type +
                              '://{user}:{password}@{host}/{database}'.format(
                                  **config[db_type]))

Session = sessionmaker(bind=db_engine)

db_session = Session()

register_session('db', db_session)


def set_session(sess):
    global db_session