Commit ed056ea1 authored by Julian Rother's avatar Julian Rother
Browse files

Added nlfix option to query to disable newline substitution

parent f5e1df0e
......@@ -84,7 +84,7 @@ elif config['DB_ENGINE'] == 'mysql':
db.close()
return res
def query(operation, *params, delim="sep"):
def query(operation, *params, delim="sep", nlfix=True):
operation, params = fix_query(operation, params)
cur = get_dbcursor()
cur.execute(operation, params)
......@@ -106,7 +106,7 @@ def query(operation, *params, delim="sep"):
if name == delim:
ptr = res[-1][col] = {}
continue
if type(col) == str:
if type(col) == str and nlfix:
col = col.replace('\\n', '\n').replace('\\r', '\r')
ptr[name] = col
return res
......
......@@ -106,7 +106,7 @@ def jobs_ping(id):
query('UPDATE jobs SET time_finished = ?, status = ?, state = "finished" where id = ?', datetime.now(), status, id)
else:
query('UPDATE jobs SET worker = ?, last_ping = ?, status = ?, state = ? where id = ?', hostname, datetime.now(), status, state, id)
job = query('SELECT * FROM jobs WHERE id = ?', id)[0]
job = query('SELECT * FROM jobs WHERE id = ?', id, nlfix=False)[0]
for func in job_handlers.get(job['type'], {}).get(state, []):
try:
func(id, job['type'], json.loads(job['data']), state, json.loads(job['status']))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment