Fix circular import

We changed auth.py to import from app.serialised_models here:
https://github.com/alphagov/notifications-api/pull/2887/files#diff-77cbb1e03185c7319f0311371c438b0cR11

`serialised_models.py` imports from `templates_dao.py`

`templates_dao.py` imports from `users_dao.py`

`users_dao.py` imports from `errors.py`

`errors.py` imports from `auth.py` … and the circle is complete 💥

For some reason this caused the Celery workers to crash on startup, but
not the app. Which I guess is why the integration tests didn’t catch
this?
This commit is contained in:
Chris Hill-Scott
2020-06-26 10:14:32 +01:00
parent 832b589980
commit 616523bf74

View File

@@ -9,7 +9,6 @@ from werkzeug.utils import cached_property
from app import db, redis_store
from app.dao import templates_dao
from app.dao.api_key_dao import get_model_api_keys
from app.dao.services_dao import dao_fetch_service_by_id
@@ -101,6 +100,7 @@ class SerialisedTemplate(SerialisedModel):
@staticmethod
@redis_cache.set('template-{template_id}-version-None')
def get_dict(template_id, service_id):
from app.dao import templates_dao
from app.schemas import template_schema
fetched_template = templates_dao.dao_get_template_by_id_and_service_id(