def dashboard(): require.logged_in() resources = logic.resource.list_by_owner(current_user.name) datasets = logic.dataset.list_by_owner(current_user.name) return render_template('account/dashboard.html', resources=resources, datasets=datasets)
def dataset_create(): """ Create a new dataset for the given user. """ require.logged_in() owner = current_user.name data = request_content(request) try: dataset = logic.dataset.create(owner, data) if 'resource' in data: # if we were simultaneously attaching a # resource, return there instead. flash('Created %s / %s' % (dataset.owner.name, dataset.name), 'success') return redirect( url_for('node', owner=data['resource']['owner'], node=data['resource']['name'])) return redirect(url_for('node', owner=owner, node=dataset.name)) except Invalid, inv: page = dataset_create_form() return htmlfill.render(page, defaults=data, errors=inv.unpack_errors())
def dataset_create(): """ Create a new dataset for the given user. """ require.logged_in() owner = current_user.name data = request_content(request) try: dataset = logic.dataset.create(owner, data) if 'resource' in data: # if we were simultaneously attaching a # resource, return there instead. flash('Created %s / %s' % (dataset.owner.name, dataset.name), 'success') return redirect(url_for('node', owner=data['resource']['owner'], node=data['resource']['name'])) return redirect(url_for('node', owner=owner, node=dataset.name)) except Invalid, inv: page = dataset_create_form() return htmlfill.render(page, defaults=data, errors=inv.unpack_errors())
def create_modal(): require.logged_in() modal = get_template_attribute('parts.html', 'create_modal') return modal()
def logout(): require.logged_in() logic.user.logout() flash('You have been logged out.', 'success') return redirect(url_for('home'))