👾 fix bug: relative paths
Static paths are now used.
This commit is contained in:
parent
af6ac6dd8d
commit
3c38890d59
1 changed files with 6 additions and 4 deletions
10
main.py
10
main.py
|
@ -1,24 +1,26 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
import logging
|
import logging
|
||||||
from redminelib import Redmine
|
from redminelib import Redmine
|
||||||
from envyaml import EnvYAML
|
from envyaml import EnvYAML
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
|
||||||
def treat_issues():
|
def treat_issues():
|
||||||
|
|
||||||
# Set up logging
|
# Set up logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
filename='marvin.log',
|
filename=dir_path + 'marvin.log',
|
||||||
level=logging.ERROR,
|
level=logging.ERROR,
|
||||||
format='%(asctime)s - %(message)s',
|
format='%(asctime)s - %(message)s',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Load configuration
|
# Load configuration
|
||||||
try:
|
try:
|
||||||
config = EnvYAML("config.yaml")
|
config = EnvYAML(dir_path + 'config.yaml')
|
||||||
url = config['redmine']['url']
|
url = config['redmine']['url']
|
||||||
version = config['redmine']['version']
|
version = config['redmine']['version']
|
||||||
api_key = config['redmine']['api_key']
|
api_key = config['redmine']['api_key']
|
||||||
|
@ -46,7 +48,7 @@ def treat_issues():
|
||||||
for issue in redmine.issue \
|
for issue in redmine.issue \
|
||||||
.filter(updated_on=f"><{action['start_date']}|{end_date.isoformat()}") \
|
.filter(updated_on=f"><{action['start_date']}|{end_date.isoformat()}") \
|
||||||
.filter(project__name__in=action['projects'], status__name__in=action['status'], closed_on=None):
|
.filter(project__name__in=action['projects'], status__name__in=action['status'], closed_on=None):
|
||||||
with open(f"templates/{action['template']}", newline='\r\n') as f:
|
with open(f"{dir_path}templates/{action['template']}", newline='\r\n') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
template = Template(content)
|
template = Template(content)
|
||||||
notes = template.render(author=issue.author.name, time_range=action['time_range'], url=issue.url)
|
notes = template.render(author=issue.author.name, time_range=action['time_range'], url=issue.url)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue