def feeds(): ''' the back end list of feeds. ''' if request.method == 'POST': if not user_session.is_admin(): flash('Only Admins can do this!') return redirect(url_for('feeds')) action = request.form.get('action', 'create') if action == 'create': if not request.form.get('title', '').strip(): flash("I'm not making you an un-named feed!") return redirect(url_for('feeds')) Feed(name=request.form.get('title', 'blank').strip()).save() try: user = user_session.get_user() except user_session.NotLoggedIn as e: user = User() return render_template('feeds.html', feeds=Feed.select(), user=user, external_sources=ExternalSource.select(), source_types=external_source_types.types())
def feeds(): ''' the back end list of feeds. ''' if request.method == 'POST': action = request.form.get('action', 'create') if action == 'create': if not request.form.get('title', '').strip(): flash("I'm not making you an un-named feed!") return redirect(url_for('feeds')) Feed(name=request.form.get('title', 'blank').strip()).save() try: user = user_session.get_user() except user_session.NotLoggedIn: user = User() return render_template('feeds.html', feeds=Feed.select(), user=user, external_sources=ExternalSource.select(), source_types=external_source_types.types())
def external_data_sources_update_all(): ''' update all external data sources. ''' sources = [x[0] for x in ExternalSource.select(ExternalSource.id).tuples()] return json.dumps([(external_source_run(s), s) for s in sources])
def external_data_sources_update_all(): ''' update all external data sources. ''' sources = [x[0] for x in ExternalSource.select(ExternalSource.id).tuples()] return json.dumps([(external_source_run(s), s) for s in sources])