Commit 8b18fb65 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team
Browse files

vidjil_utils.py: loglinks, scheduler task

parent 219c6704
import math import math
import re import re
import defs
from gluon import current from gluon import current
def format_size(n, unit='B'): def format_size(n, unit='B'):
...@@ -83,6 +84,7 @@ def filter(str, filter_str): ...@@ -83,6 +84,7 @@ def filter(str, filter_str):
log_patient = re.compile('\((\d+)\)') log_patient = re.compile('\((\d+)\)')
log_config = re.compile(' c(\d+)') log_config = re.compile(' c(\d+)')
log_task = re.compile('\[(\d+)\]')
def log_links(s): def log_links(s):
'''Add HTML links to a log string '''Add HTML links to a log string
...@@ -103,6 +105,9 @@ def log_links(s): ...@@ -103,6 +105,9 @@ def log_links(s):
m_config = log_config.search(s) m_config = log_config.search(s)
config = m_config.group(1) if m_config else None config = m_config.group(1) if m_config else None
m_task = log_task.search(s)
task = int(m_task.group(1)) if m_task else None
### Rules ### Rules
url = '' # href link url = '' # href link
...@@ -120,6 +125,13 @@ def log_links(s): ...@@ -120,6 +125,13 @@ def log_links(s):
start += 1 start += 1
end -= 1 end -= 1
elif task:
call = "admin/log"
args = {'file': '../../' + defs.DIR_OUT_VIDJIL_ID % task + 'vidjil.log'}
(start, end) = m_task.span()
start += 1
end -= 1
### Build final string ### Build final string
link = '' link = ''
......
Markdown is supported
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