Example #1
0
def getAdminData(self, **params):
    """
    Deliver admin content of module settings (ajax)

    :return: rendered template as string or json dict
    """
    if request.args.get('action') == 'checkpath':
        if os.path.exists(request.args.get('path')):
            return '1'
        return '0'

    elif request.args.get('action') == 'upgradedb':
        try:
            alembic.upgrade()
            return str(alembic.current())
        except:
            return babel.gettext(u'admin.settings.updatedberror')

    elif request.args.get('action') == 'downgradedb':
        return alembic.downgrade() or "done"

    elif request.args.get('action') == 'sendtelegramtest':
        from emonitor.extensions import communication
        communication.telegram.sendMessage(addressee=int(request.args.get('user')), message=request.args.get('msg'))
        return babel.gettext(u'admin.settings.telegramtest.done')

    return ""
Example #2
0
def getAdminData(self, **params):
    """
    Deliver admin content of module settings (ajax)

    :return: rendered template as string or json dict
    """
    if request.args.get('action') == 'checkpath':
        if os.path.exists(request.args.get('path')):
            return '1'
        return '0'

    elif request.args.get('action') == 'upgradedb':
        try:
            alembic.upgrade()
            return str(alembic.current())
        except:
            return babel.gettext(u'admin.settings.updatedberror')

    elif request.args.get('action') == 'downgradedb':
        return alembic.downgrade() or "done"

    elif request.args.get('action') == 'sendtelegramtest':
        from emonitor.extensions import communication
        communication.telegram.sendMessage(addressee=int(request.args.get('user')), message=request.args.get('msg'))
        return babel.gettext(u'admin.settings.telegramtest.done')

    return ""
def getAdminData(self, **params):
    """
    Deliver admin content of module settings (ajax)

    :return: rendered template as string or json dict
    """
    if request.args.get('action') == 'checkpath':
        if os.path.exists(request.args.get('path')):
            return '1'
        return '0'

    elif request.args.get('action') == 'upgradedb':
        try:
            alembic.upgrade()
            return str(alembic.current())
        except:
            return babel.gettext(u'admin.settings.updatedberror')

    elif request.args.get('action') == 'downgradedb':
        return alembic.downgrade() or "done"

    return ""