Skip to content

Commit

Permalink
prevents weird "import from partially initialized module" error.
Browse files Browse the repository at this point in the history
  • Loading branch information
smirolo committed Oct 1, 2024
1 parent c19299a commit 90da370
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ After cloning the repository, create a virtualenv environment, install
the prerequisites, create the database then run the testsite webapp.

<pre><code>
$ virtualenv <em>installTop</em>
$ source <em>installTop</em>/bin/activate
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r testsite/requirements.txt
$ make vendor-assets-prerequisites

Expand Down
10 changes: 7 additions & 3 deletions extended_templates/backends/eml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020, Djaodjin Inc.
# Copyright (c) 2024, Djaodjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand All @@ -25,7 +25,6 @@
import codecs, logging, os, warnings

from bs4 import BeautifulSoup
import django
from django.core.mail import EmailMultiAlternatives
from django.template import engines
from django.utils.html import strip_tags
Expand Down Expand Up @@ -140,7 +139,12 @@ def get_template(self, template_name, dirs=_dirs_undefined):
if dirs is _dirs_undefined:
return Template(self.engine.get_template(
template_name), engine=self)
if django.VERSION[0] >= 1 and django.VERSION[1] >= 8:
# We cannot `import django` at toplevel with Django4.2,
# as it will create an import loop in the `requests` module
# through `premailer`. Don't ask.
#pylint:disable=import-outside-toplevel
from django import VERSION as DJANGO_VERSION
if DJANGO_VERSION[0] >= 1 and DJANGO_VERSION[1] >= 8:
warnings.warn(
"The dirs argument of get_template is deprecated.",
RemovedInDjango110Warning, stacklevel=2)
Expand Down

0 comments on commit 90da370

Please sign in to comment.