def __init__(self, cur_flow_list=[], json_events=[]): # print(rule.list) self.flows = [] for json_event in json_events: flow = Flow.Flow() flow.set(json_event) self.flows.append(flow)
def flow(): """Route vers le lecteur d'URL pour flux rss/atom""" user_id = current_user.get_id() form = URLForm() if form.validate_on_submit(): flow = Flow(url=form.url.data, user=user_id) flow.save() return render_template("flow.html", form=form)
def deleteFlow(self, json_content): flow = Flow.Flow() flow.id = json_content["id"] with db_session() as db: # flow.delete() # Delete from DB flow.delete_db(db) db.commit() return {"response": "delete_done"}
def post_flow(self, data): data["obj"]["waktu"] = datetime.datetime.strptime( data["obj"]["waktu"], "%Y-%m-%d") try: flow = Flow.selectBy(gateID=data["obj"]["gateID"], waktu=data["obj"]["waktu"])[0] flow.opened = data["obj"]["opened"] flow.timed = data["obj"]["timed"] flow.value = data["obj"]["value"] # flow autosave, karena tidak 'lazyUpdate' except IndexError: Flow(**data["obj"])
def init_DB(self): # if connection_string.startswith('sqlite'): # db_file = re.sub("sqlite.*:///", "", connection_string) # os.makedirs(os.path.dirname(db_file)) # 3 commands for creating database base = Base.Base() Flow.Flow() engine = assert_database_type() base.metadata.create_all(engine) response = "OK" return response
def getFlow(self, json_content): flow = Flow.Flow() if json_content is not None and bool(json_content) is True: flow.set(json_content) response = flow.get_by_filter() return response
from neo4jrestclient import GraphDatabase from models import Flow, Question, Answer flows = [ Flow( 'morrowind', "Morrowind-style", "A fantasy character creation process like the one at the start of the game Morrowind." ) ] def morrowind_flow(start_node): flow_id = 'morrowind' question_index = db.nodes.indexes.get('questions') q1 = Question(id='q1', text='What surrounded you when you were young?', answers=[ Answer(id='q1a1', text='The sea', reward_type='Background', reward_value='Coastal', next='q4'), Answer(id='q1a2', text='Fields', reward_type='Background', reward_value='Rural', next='q2'), Answer(id='q1a3', text='Buildings', reward_type='Background',