Beispiel #1
0
def time_localize(value):
    return TimeManager.localize(value)
Beispiel #2
0
 def last_active(self):
     if self._last_active is None:
         return None
     return TimeManager.localize(self._last_active)
Beispiel #3
0
config = load_config(args.config)

if 'web' not in config:
    log.error('Missing [web] section in config.ini')
    sys.exit(1)

if 'pleblist_password_salt' not in config['web']:
    salt = generate_random_salt()
    config.set('web', 'pleblist_password_salt', salt.decode('utf-8'))

with open(args.config, 'w') as configfile:
    config.write(configfile)

DBManager.init(config['main']['db'])
TimeManager.init_timezone(config['main'].get('timezone', 'UTC'))

session = DBManager.create_session()
num_decks = session.query(func.count(Deck.id)).scalar()
custom_web_content = {}
for web_content in session.query(WebContent).filter(WebContent.content is not None):
    custom_web_content[web_content.page] = web_content.content
session.close()

has_decks = num_decks > 0

errors.init(app)
api.config = config

modules = config['web'].get('modules', '').split()
Beispiel #4
0
 def last_seen(self):
     return TimeManager.localize(self._last_seen)