def dashboard(): """If this session has not yet been initialized (i.e. we don't yet have an oauth_token from Figshare), it starts up the three-legged authentication procedure for OAuth v1. Otherwise, it initializes the session variable with the article details of the Figshare author """ if g.user.oauth_token == None or g.user.oauth_token == "" : """This user does not yet have an oauth_token, so redirect to the authorization page""" return redirect(url_for('figshare_authorize')) else : """ This is where we retrieve all articles of the Figshare author who provided the authentication. """ try : get_articles() return render_template('articles.html', raw = str(session['items']), results = session['items'], plugins = plugins.values(), user = g.user) except FigshareEmptyResponse as e : app.logger.error(e) return redirect(url_for('figshare_authorize')) except FigshareNoTokenError as e : app.logger.error(e) return redirect(url_for('figshare_authorize')) except Exception as e : app.logger.error(e) return render_template('error.html', message = "Error retrieving articles!: " + e.message, user=g.user)
def load_plugins(): return jsonify({'result': plugins.values()})
def dashboard(): return render_template('articles.html', user = g.user, results = {}, plugins = plugins.values())