Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Django 1.10 (render_to_string changed) #68

Closed
cybelew opened this issue Sep 12, 2016 · 4 comments
Closed

Incompatibility with Django 1.10 (render_to_string changed) #68

cybelew opened this issue Sep 12, 2016 · 4 comments

Comments

@cybelew
Copy link

cybelew commented Sep 12, 2016

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())
@jacobwegner
Copy link

I am working on a fix for this in fix-template-deprecations.

The fix will introduce a backwards-incompatible change with plain text notification templates and auto-escaping.

@bnisevic
Copy link

bnisevic commented Nov 4, 2016

When do you plan to merge this?

@jacobwegner
Copy link

@bnisevic: We've just released pinax-notifications v4.0.0 on PYPI, which resolves this issue.

@thecybil thanks for the report!

@bnisevic
Copy link

bnisevic commented Nov 4, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants