Anton Shestakov <av6@dwimlabs.net>, Thu, 11 Aug 2016 13:03:42 +0800
pipelines: write valid yaml
Pipelines don't yet support multiple steps, but let's see what happens.
app.py
Permissions: -rwxr-xr-x
from flask import Flask, g, render_template from flask_assets import Environment from flask_restful import Api from CodernityDB.database_thread_safe import ThreadSafeDatabase from fruitbar.indexes import ProjectIndex, TaskIndex from fruitbar.crud import ResourceList, ResourceCombiner, CRUDResource app.config.from_object(__name__) assets = Environment(app) @app.before_first_request db_path = os.path.join(os.path.dirname(__file__), app.config['DATABASE']) cdb = ThreadSafeDatabase(db_path) cdb.add_index(ProjectIndex(cdb.path, 'project')) cdb.add_index(TaskIndex(cdb.path, 'task')) return render_template('index.html') class ProjectList(ResourceList): doc_stub = {'_t': 'project'} class Project(CRUDResource): safe_fields = ('name', 'color') def delete(self, workspace, resource_id): g.db.run('task', 'delete_for_project', workspace, resource_id) return super(Project, self).delete(workspace, resource_id) class TaskList(ResourceList): doc_stub = {'_t': 'task'} class Task(CRUDResource): safe_fields = ('name', 'note', 'done') class ProjectsAndTasks(ResourceCombiner): api.add_resource(ProjectList, '/<workspace>/projects/') api.add_resource(Project, '/<workspace>/projects/<resource_id>/') api.add_resource(TaskList, '/<workspace>/tasks/') api.add_resource(Task, '/<workspace>/tasks/<resource_id>/') api.add_resource(ProjectsAndTasks, '/<workspace>/all/') if __name__ == '__main__':