From 6a884acff5a1c6af11836e5f8e9f8304b61f00ea Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sat, 25 Mar 2017 17:27:45 -0700 Subject: [PATCH] signals: Avoid importing bugdown from early initialization. This fixes `tools/build-release-tarballs` failing. --- zerver/signals.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zerver/signals.py b/zerver/signals.py index 88b3cf30d9..f46e1dd82b 100644 --- a/zerver/signals.py +++ b/zerver/signals.py @@ -8,10 +8,6 @@ from django.template import loader from django.utils import timezone from typing import Any, Dict, Optional -from zerver.context_processors import common_context -from zerver.models import UserProfile - - def get_device_browser(user_agent): # type: (str) -> Optional[str] user_agent = user_agent.lower() @@ -54,6 +50,11 @@ def get_device_os(user_agent): def email_on_new_login(sender, user, request, **kwargs): # type: (Any, UserProfile, Any, Any) -> None + # We import here to minimize the dependencies of this module, + # since it runs as part of `manage.py` initialization + from zerver.context_processors import common_context + from zerver.models import UserProfile + if not settings.SEND_LOGIN_EMAILS: return