From 8666b5e207e5e2b51e4e3262d9f730478d61382e Mon Sep 17 00:00:00 2001 From: Josh Guffey Date: Thu, 18 Oct 2018 09:51:14 -0700 Subject: [PATCH] test for meta --- shared_session/templatetags/shared_session.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared_session/templatetags/shared_session.py b/shared_session/templatetags/shared_session.py index cd574aa..ed4a31f 100644 --- a/shared_session/templatetags/shared_session.py +++ b/shared_session/templatetags/shared_session.py @@ -66,6 +66,10 @@ def render(self, context): if request.session.is_empty(): return '' + # Sometimes host is not in meta, ex. in tests. + if 'HTTP_HOST' not in request.META: + return '' + try: self.ensure_session_key(request)