-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use libreoffice to generate pdf file from docx #1202
Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
6da5842
to
38c6743
Compare
e41fe05
to
58d869b
Compare
ffbaf02
to
14e2c8c
Compare
46fa705
to
1b2167b
Compare
29ee271
to
bca4e9d
Compare
4fd8a42
to
9c85e38
Compare
@@ -82,7 +83,7 @@ def _compute_total_locaux_collectifs(convention): | |||
) | |||
|
|||
|
|||
def generate_convention_doc(convention: Convention, save_data=False): | |||
def generate_convention_doc(convention: Convention, save_data=False) -> DocxTemplate: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca me parait mieux que generate_convention_doc
retourne une instance de doc plutôt que des bytes.
Ca simplifie également par la suite ici, pour l'écriture dans un fichier local.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
def get_tmp_local_path() -> Path: | ||
local_path = Path(settings.MEDIA_ROOT, "tmp") | ||
local_path.mkdir(parents=True, exist_ok=True) | ||
return local_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposition: écrire les fichiers locaux temporaire dans un répertoire "tmp" plutôt qu'à la racine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
except (subprocess.CalledProcessError, OSError) as err: | ||
raise PDFConversionError from err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: il y a sûrement d'autres exceptions à catcher ici
chain( | ||
task_generate_pdf.s(convention_uuid), | ||
task_send_email_to_bailleur.si( | ||
convention_uuid, | ||
convention_url, | ||
convention_email_validator, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La feature Celery chain permet de lier les deux tâches et d'ajuster ainsi les paramètre de retry à chacune d'elle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
core/settings.py
Outdated
@@ -575,6 +575,7 @@ def get_env_variable(name, cast=str, default=""): | |||
CELERY_SEND_EVENTS = True | |||
CELERY_ACKS_LATE = True | |||
CELERY_WORKER_MAX_TASKS_PER_CHILD = 5000 | |||
CELERY_ALWAYS_EAGER = get_env_variable("CELERY_ALWAYS_EAGER", cast=bool, default=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fe1f084
to
cb64a55
Compare
|
To do