示例#1
0
def user_cp():

    form = LocalizationForm(request.form)
    form.language.choices = locales.items()
    form.language.data = UserController.locale_get()

    return themes.render('main/user_cp', form=form)
示例#2
0
def static(filename):
    if filename.startswith('/'):
        return abort(404)

    from findex_gui import themes

    filename = filename.replace('..', '')
    filename = filename.replace('./', '')

    search_dirs = ['static/']

    # if not settings.local:
    #     search_dirs.insert(0, 'themes/_setup/static/')

    if filename.startswith('themes/'):
        spl = filename.split('/')

        if len(spl) >= 3 and spl[2] == 'static':
            filename = '/'.join(spl[3:])
            search_dirs.insert(0, 'themes/%s/static/' % spl[1])

    for search_dir in search_dirs:
        directory = '%s/%s' % (app.config['dir_base'], search_dir)

        if os.path.isfile(directory + filename):
            return send_from_directory(directory, filename)

    return themes.render('errors/404', status_code=404)
示例#3
0
def search(parsed):
    search = SearchController()

    errors = []
    results = []

    try:
        # @TO-DO: check theme whether to do REST API searching or flask->jinja2
        #results = search.search(**args)
        pass
    except Exception as ex:
        errors.append('error %s' % str(ex))

    return themes.render('main/search', results=[], errors=errors, session=session)
示例#4
0
def login():
    if get_current_user_data():
        return redirect('/', 302)

    error = None

    if request.method == 'POST':
        username = request.form['username']
        password = request.form['password']

        if UserController.authenticate_and_session(username, password):
            flash(gettext('You were successfully logged in'))
            if request.referrer.endswith('/login'):
                return redirect(url_for('root'))

            return redirect(redirect_url())
        else:
            error = gettext('Invalid credentials')

    return themes.render('main/login', error=error)
示例#5
0
def search_home():
    return themes.render('main/search')
示例#6
0
文件: main.py 项目: skftn/findex-gui
def root():
    return themes.render("main/home")
示例#7
0
文件: main.py 项目: skftn/findex-gui
def error(e):
    return themes.render("main/error", msg=str(e))
示例#8
0
def admin_servers():
    return themes.render('main/servers', theme="_admin")