Open BojanKogoj opened 6 years ago
If I understand this correctly it is crashing because get_language() is returning None and join doesn't accept None parameters https://github.com/peopledoc/django-mail-factory/blob/master/mail_factory/mails.py#L71
get_language()
None
join
Using Django 1.11.5
Relevant traceback
/code/myapp/something/utils.py in _get_or_create_user(self, appointment) 42 'url': url 43 }) ---> 44 msg.send([user.email]) 45 46 return user /usr/local/lib/python3.6/site-packages/mail_factory/mails.py in send(self, emails, attachments, from_email, headers) 151 """Create the message and send it to emails.""" 152 message = self.create_email_msg(emails, attachments=attachments, --> 153 from_email=from_email, headers=headers) 154 message.send() 155 /usr/local/lib/python3.6/site-packages/mail_factory/mails.py in create_email_msg(self, emails, attachments, from_email, lang, message_class, headers) 104 105 from_email = from_email or settings.DEFAULT_FROM_EMAIL --> 106 subject = self._render_part('subject.txt', lang=lang).strip() 107 try: 108 body = self._render_part('body.txt', lang=lang) /usr/local/lib/python3.6/site-packages/mail_factory/mails.py in _render_part(self, part, lang) 89 90 """ ---> 91 tpl = select_template(self.get_template_part(part, lang=lang)) 92 cur_lang = translation.get_language() 93 try: /usr/local/lib/python3.6/site-packages/mail_factory/mails.py in get_template_part(self, part, lang) 69 templates = [] 70 # 1/ localized: mails/invitation_code/fr/ ---> 71 localized = join('mails', self.template_name, lang or self.lang, part) 72 templates.append(localized) 73 /usr/local/lib/python3.6/posixpath.py in join(a, *p) 92 path += sep + b 93 except (TypeError, AttributeError, BytesWarning): ---> 94 genericpath._check_arg_types('join', a, *p) 95 raise 96 return path /usr/local/lib/python3.6/genericpath.py in _check_arg_types(funcname, *args) 147 else: 148 raise TypeError('%s() argument must be str or bytes, not %r' % --> 149 (funcname, s.__class__.__name__)) from None 150 if hasstr and hasbytes: 151 raise TypeError("Can't mix strings and bytes in path components") from None TypeError: join() argument must be str or bytes, not 'NoneType'
If I understand this correctly it is crashing because
get_language()
is returningNone
andjoin
doesn't accept None parameters https://github.com/peopledoc/django-mail-factory/blob/master/mail_factory/mails.py#L71Using Django 1.11.5
Relevant traceback