Skip to content

Incompatibility with Django 1.10 (render_to_string changed) #68

@cybelew

Description

@cybelew

I'm getting an exception when trying to call send().

  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/pinax/notifications/models.py", line 187, in send
    return send_now(*args, **kwargs)
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/pinax/notifications/models.py", line 161, in send_now
    backend.deliver(user, sender, notice_type, extra_context)
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/pinax/notifications/backends/email.py", line 36, in deliver
    }, context).splitlines())
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/django/template/loader.py", line 68, in render_to_string
    return template.render(context, request)
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/django/template/base.py", line 206, in render
    with context.bind_template(self):
  File "/home/vagrant/.pyenv/versions/2.7.12/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/django/template/context.py", line 236, in bind_template
    updates.update(processor(self.request))
  File "/home/vagrant/.pyenv/versions/eoi/lib/python2.7/site-packages/django/template/context_processors.py", line 43, in debug
    if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:

The dictionary and context_instance parameters were removed from django.template.loader.render_to_string() in Django 1.10 (https://docs.djangoproject.com/en/1.10/releases/1.10/). The new docs on render_to_string are here: http://django.readthedocs.io/en/latest/topics/templates.html#django.template.loader.render_to_string).

However, pinax/notifications/backends/email.py calls it like so:

        subject = "".join(render_to_string("pinax/notifications/email_subject.txt", {
            "message": messages["short.txt"],
        }, context).splitlines())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions