Extract parser
This commit is contained in:
13
action.py
13
action.py
@@ -11,7 +11,8 @@ class Action:
|
||||
def __init__(self, row):
|
||||
if not row:
|
||||
logging.debug('Action - empty row')
|
||||
raise Exception('No action found - database need to be initialized.')
|
||||
# TODO
|
||||
# raise Exception('No action found - database need to be initialized.')
|
||||
else:
|
||||
logging.debug('Action - fill fields')
|
||||
self.project_id, self.task_id, self.note_id = row
|
||||
@@ -19,6 +20,16 @@ class Action:
|
||||
def __str__(self):
|
||||
return str(self.__dict__)
|
||||
|
||||
def handle_action(args, last_action, conn):
|
||||
logging.info('>> handle action')
|
||||
query = 'SELECT * FROM action;'
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(query)
|
||||
for row in cursor.fetchall():
|
||||
result = row
|
||||
logging.debug(result)
|
||||
|
||||
|
||||
def create_action(cursor, project_id = '', task_id = '', note_id = '', message = ''):
|
||||
query = """
|
||||
INSERT INTO action (project_id, task_id, note_id, username, message, created_at)
|
||||
|
||||
Reference in New Issue
Block a user