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)
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)
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)
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)
def search_home(): return themes.render('main/search')
def root(): return themes.render("main/home")
def error(e): return themes.render("main/error", msg=str(e))
def admin_servers(): return themes.render('main/servers', theme="_admin")